0

I have been using this code on a webpage for about 2 years and all of the sudden it started giving me an error. Is there any noticeable reason why?These are lines 116 through 120 that are referenced in the error

$file = fopen("http:/xxxxxx/climo/reports/".$fileName, "r");
              $content = fgetcsv($file, 1000, ",");

              $id = 1;
              while ($content = fgetcsv($file, 1000, ",") != FALSE) {

error

.gov/climo/reports/today_raw_hail.csv) [function.fopen]: failed to open stream: no suitable wrapper could be found in /homepages/27/xxxx/htdocs/xxxxx/weather/php/mainEngine.php on line 116

Warning: fgetcsv() expects parameter 1 to be resource, boolean given in /homepages/27/xxxxx/htdocs/xxxx/weather/php/mainEngine.php on line 117

Warning: fgetcsv() expects parameter 1 to be resource, boolean given in /homepages/27/xxxx/htdocs/xxxx/weather/php/mainEngine.php on line 120
shinjuo
  • 20,498
  • 23
  • 73
  • 104

2 Answers2

2

Your host probably updated the 'allow_url_fopen' directive in the php.ini

http://php.net/manual/en/filesystem.configuration.php

Orangepill
  • 24,500
  • 3
  • 42
  • 63
  • After some research with my hosting it appears they have set URL file-access to no. I need to manually turn it on now. Thanks for the help – shinjuo May 24 '13 at 19:01
0

Apparently your hosting provider dropped support for http:// urls (as you can see in the errors).

Try reading the csv with curl instead.

Arnaud Le Blanc
  • 98,321
  • 23
  • 206
  • 194