am fairly new to php and I am currently stuck on the fopen. My script is as follows:
$url = sprintf('http://finance.yahoo.com/d/quotes.txt?s=%s&f=sl1d1t1c1ohgv&e=.txt/', $symbol[$i]);
$fp = fopen($url, 'r');
if(!$fp)
{
echo 'Error recieving stock information.';
}
else
{
$array = fgetcsv($fp , 4096 , ', ');
fclose($fp);
$symbol is defined as an array with all my ticker symbols that I need to retrieve. When I use this on my local machine it works perfectly, but when I try to use it on my hosts server, it gives me the following warning messages:
Warning: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /var/www/html/deric/ticker.php on line 17
Warning: fopen("http://finance.yahoo.com/d/quotes.txt?s=DJI&f=sl1d1t1c1ohgv&e=.txt//","r") - Bad file descriptor in /var/www/html/deric/ticker.php on line 17
Error recieving stock information.%3Cfont+color%3D%22%23FFDE42%22%3EDJIA++%3C%2Ffont%3E%3C%2Ffont%3E+++
Can anyone give me any suggestions to fix this. Thanks a lot