I'm trying to access user information using the Geocaching.com API service. Using the following script I get the errors mentioned below:
If i use it 'straight out of the box' (on a live server) i get back the following message:
Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in /home/mrmemeco/public_html/geo/src/Geocaching/OAuth/OAuth.php on line 329
Fatal error: Uncaught exception 'Exception' with message '28' in /home/mrmemeco/public_html/geo/src/Geocaching/OAuth/OAuth.php:334 Stack trace: #0 /home/mrmemeco/public_html/geo/src/Geocaching/OAuth/OAuth.php(206): Geocaching\OAuth\OAuth->curl_request('http://staging....') #1 /home/mrmemeco/public_html/geo/index.php(50): Geocaching\OAuth\OAuth->getRequestToken() #2 {main} thrown in /home/mrmemeco/public_html/geo/src/Geocaching/OAuth/OAuth.php on line 334
If i use it in the same way but on a localhost is get back HTTP error: 0 and no data is returned.
I've done a bit of googling and i have checked that safe mode is off but I've had no joy still.
It's definitely not my API keys as they work perfectly on the live demo
You get that error because the configuration of your server doesn't allow cUrl to follow locations. There is more than one way to solve this:
safe_mode = false
.htaccess
file in the root of your site and put this insidephp_value safe_mode off
or...safe_mode
in your PHP script adding this line at theini_set('safe_mode', false);
I hope it helps