PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
$headers = get_headers('http://'.$url.'/robots.txt');
print_r($headers);
// look at $headers[0]
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
I don't know. That should work fine, what's the problem?
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
$headers = get_headers('http://'.$url.'/robots.txt');
print_r($headers);
// look at $headers[0]
What does this show?
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
So that is telling us that the server returned something, 200 OK. Whether it was a robots.txt file or not we can't tell. If the server does not return a 404 then fopen() thinks it opened it.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
But if the file doesn't exist, I get an error message:
Warning: fopen() [function.fopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/wildfir1/public_html/AREA-52/DS/db.php on line 200
Warning: fopen(http://http://www.heidelbergpr.com/robots.txt) [function.fopen]: failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/wildfir1/public_html/AREA-52/DS/db.php on line 200