Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
White plugin page
#3
n00dles101 Wrote:I have this on my local builds also and its caused by local firewall preventing the CURL calls to the GetSimple servers.

Just comment out line 1028 of template_function.php , this one:

Code:
$data = file_get_contents($fetch_this_api);

and its should work fine.

Thanks mr. N00dles101

I do this in my template_function.php and it seems to work.
Line 1004 isn't enough.

Code:
# debugLog($fetch_this_api.' ' .$cachefile);
    if (file_exists(GSCACHEPATH.$cachefile) && time() - 40000 < filemtime(GSCACHEPATH.$cachefile)) {
        # grab the api request from the cache
        $data = file_get_contents(GSCACHEPATH.$cachefile);
    } else {    
        # make the api call
        if (function_exists('curl_exec')) {
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_TIMEOUT, 2);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_URL, $fetch_this_api);
//            $data = curl_exec($ch);                           COMMENTED LINE 1001
            curl_close($ch);
        } else {
//            $data = file_get_contents($fetch_this_api);       COMMENTED LINE 1004
        }
    $response = json_decode($data);        
        // we make sure our response is valid before saving it to disk,
        // to avoid corrupt or infected cache files from being saved to local filesystem.
        if($response){
            file_put_contents(GSCACHEPATH.$cachefile, $data);
            chmod(GSCACHEPATH.$cachefile, 0644);
        }    
    }
    return $data;
}

But I still do not understand why until yesterday everything worked well
(same GS 3.1.2 & EasyPhp)
------
Sorry for my English but when I was young
instead of studying I preferred to train in judo.
------
Reply


Messages In This Thread
White plugin page - by mc_abt - 2012-09-07, 18:44:33
White plugin page - by n00dles101 - 2012-09-07, 19:36:35
White plugin page - by mc_abt - 2012-09-07, 20:17:25



Users browsing this thread: 1 Guest(s)