Support » Plugin: Alfie WP Weather » file_get_contents() alternative (cURL)

  • Resolved CroModder


    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!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘file_get_contents() alternative (cURL)’ is closed to new replies.