if recently download the latest version of xampp (1.7.7: Apache 2.2.21/MySQL 5.5.16/PHP 5.3.8)
I'm using file_get_contents to download clients sites and check if an update on our in-house cms is required.
Code:
$host = 'localhost';
$user = 'username';
$pass = 'password';
$db = 'database';
$con = mysql_connect($host,$user,$pass);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($db, $con);
$query_site_to_scan = sprintf("SELECT * FROM site WHERE (site_scanned = '0' OR site_scanned = '') LIMIT 0, 1");
$site_to_scan = mysql_query($query_site_to_scan, $con) or die(mysql_error());
$row_site_to_scan = mysql_fetch_assoc($site_to_scan);
$totalRows_site_to_scan = mysql_num_rows($site_to_scan);
do {
$domain = 'http://www.'.$row_site_to_scan['site_address'];
$file = file_get_contents($domain);
} while ($row_site_to_scan = mysql_fetch_assoc($site_to_scan));
$row_site_to_scan['site_address'] outputs example.com the code above doesn't work! the code does however work when $domain = 'http://www.example.com' or $domain = 'http://www.'.'example.com'
I've never had this problem at all before!
The error message reads:
Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: No such host is known. in Z:\xampp\htdocs\update\index.php on line 24
Warning: file_get_contents(http://www.example.com ) [function.file-get-contents]: failed to open stream: php_network_getaddresses: getaddrinfo failed: No such host is known. in Z:\xampp\htdocs\update\index.php on line 24
again the code works 100% if the file_get_contents source doesnt come from the database...
ALSO database table field type is varchar(255) and collation is latin1_swedish_ci. The same as I've always used in previous versions of xampp and never had a problem.
Thanks in advance guys 'n' gals!!!