Alfie WP Weather
[resolved] file_get_contents() alternative (cURL) (2 posts)

  1. CroModder
    Posted 2 years ago #

    First of all, praise for the plugin :)
    I tried it and it works perfect on localhost but when I put it online it doesn't work. I read FAQ, phpinfo() says that allow_url_fopen is turned on, and I tried playing with .htaccess and php.ini but apparently there is something messed up with permissions or there is some other problem with hosting.
    So I edited getfeed.php, replacing:
    $json = file_get_contents( $api, 0, null, null );

    function file_get_contents_curl($url) {
    	$ch = curl_init();
    	curl_setopt($ch, CURLOPT_HEADER, 0);
    	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //Set curl to return the data instead of printing it to the browser.
    	curl_setopt($ch, CURLOPT_URL, $url);
    	$data = curl_exec($ch);
    	return $data;
    $json = file_get_contents_curl($api);

    But the plugin still doesn't show up. Can you give me some instructions what else can I try?

    Thanks in advance!


  2. CroModder
    Posted 2 years ago #

    Problem solved. Curl was disabled in hosting configuration. Now works fine.
    Marking as resolved.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic