Question

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
Was it helpful?

Solution

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

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

OTHER TIPS

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

Try reading the csv with curl instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top