I am trying to extract all the html from a URL and insert it into a database, I cannot get fsocket to work. I probably just don't know what I am doing!!!!
/////////////////////////////////////////Code I am using
$fp = fsockopen("http://www2.cslb.ca.gov/CSLB_LIBRARY/License+Detail.asp?LicNum=708534", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: www.example.com\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
/////////////////////////////////////////Error I am getting
Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/public_html/crawler/fsocket.php on line 5
Warning: fsockopen(): unable to connect to http://www2.cslb.ca.gov/CSLB_LIBRARY/License+Detail.asp?LicNum=708534:80 in /home/public_html/crawler/fsocket.php on line 5
Permission denied (13)
Thanks for any help