Dave_Sinkula, the code that you posted is very good, i used it on my program, i just had to use a pointer to point where the http begin, but the problem is, your code just print the host, but i need all the URL (cboard.cprogramming.com/online.php).
Well, here is my code to compile:
Code:
#include <stdio.h>
#include <string.h>
main()
{
char *begin, *end, url[200];
int length;
char *headers = "GET http://www.google.com/intl/en/about.html HTTP/1.1\nHost: www.google.com\nAccept: text/html\nAccept: video/mpg\nAccept: image/jpg\nUser-Agent: Mozilla/5.0\n";
if ((begin = strstr(headers, "http")) != NULL)
;
else if ((begin = strchr(headers, '/')) != NULL)
;
else {
printf("URL not found\n");
return 1;
}
end = strchr(begin, ' ');
length = strlen(begin) - strlen(end);
strncpy(url, begin, length);
printf("%s\n", url);
return 0;
}
/* my output is: http://www.google.com/intl/en/about.htmlç~ */
Thanx for your help.