Ya, I am simply trying to grab the html from a web page. I've tried down loading and using cURL... this seems like a very powerful tool and bit confusing, I think I'm just making it too hard. Any suggestions... Thanks.
Printable View
Ya, I am simply trying to grab the html from a web page. I've tried down loading and using cURL... this seems like a very powerful tool and bit confusing, I think I'm just making it too hard. Any suggestions... Thanks.
Why would you want to do that?
Networking question, methinks, so moved to Networking/Device Communication.
You probably could read a tutorial such as Beej's Guide to Network Programming for the basics.
I'm trying to update some records, with information provided from a county web site. Ya, they put me in charge of doing this by hand, so I'm trying to write a program to to this for me... : ). that's why we have computers right..
I would use a more adequate programming language, where such things are a little easier, such as Perl or PHP.
curl is extremely useful when working with webpages... if you can get it working with PHP (I'm 90% sure there is a curl extension for php) then more power to you. Otherwise, C++ strings and curl still make a great pair.
Raw sockets (with PHP or C/C++) are more trouble than they're usually worth, dealing with premature data (some servers (IIS, I think) send something like 200 Continues while the request is being made...) parsing out headers, and dechunking. And only then do you get to parse the data...
To the OP: What exactly are you having trouble with? Any specific errors? What OS/compiler?
In PHP, you can simply write:
and then use it just as you would a text file.Code:$handle = fopen("http://www.example.com/", "r");
You could also write:
or even use the curl library.Code:$viart_xml = fsockopen("www.viart.com", 80, $errno, $errstr, 12);
fputs($viart_xml, "GET /viart_shop.xml HTTP/1.0\r\n");
fputs($viart_xml, "Host: www.viart.com\r\n");
fputs($viart_xml, "Referer: http://www.viart.com\r\n");
fputs($viart_xml, "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n\r\n");