Ashley’s
Comments
(group member since Jun 12, 2013)
Ashley’s
comments
from the Goodreads Developers group.
Showing 1-6 of 6


The code snippet I pasted is not from the oauth part of the plugin. That was just an example completely unrelated to oauth of how a simple curl function fails on this server. Simply fetching goodreads.com with no oauth code returns a 403 Forbidden error. That says there's something fundamentally wrong.
In my actual oauth code I do follow all the guidelines and set the callback_url.
The code is working perfectly fine on 80+ other sites. It's just this specific site/server where there's any problem.

OAuth uses cURL on the request token page ( http://www.goodreads.com/oauth/reques... ). But that's returning a 403 error (as noted above...) so she never actually gets to the point of passing through the API key and approving the connection.
Any request to any Goodreads page results in a 403 from her server, so the API key never even reaches a Goodreads connection.

And as you can see from the code above, simply performing a curl request on the Goodreads homepage results in a 403 forbidden. Pasting that EXACT same code on any of the sites where the plugin works does not result in a 403.
That code I pasted is just an example. The plugin in question uses OAuth, and she is also getting errors when using OAuth to try to connect to Goodreads itself. She can't even get to the stage of posting a new review via the plugin because she can't authorize her account with Goodreads in the first place due to the 403. The plugin has two stages:
1) Connect to Goodreads using OAuth
2) Submit a post to Goodreads to use as a review
She cannot get past step #1 so she hasn't even attempted doing #2 yet since she can't get the connection in the first place.

function ubb_fetch_page($url, $timeout = 5) {
$raw = false;
if (in_array('curl', get_loaded_extensions())) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
$raw = curl_exec($ch);
curl_close($ch);
}
else {
$raw = @file_get_contents($url);
}
return $raw;
}
$page = ubb_fetch_page('https://www.goodreads.com');
var_dump($page);
===============
That returns back a 403 Forbidden page. As do all the OAuth requests, presumably for the same reason (whatever that is). This doesn't happen on any other sites where the plugin is working.

Here is another example of this:
http://www.goodreads.com/book/title?f...
The above XML formatted URL returns full book information, including image/title/author/series/etc.
You switch the format to JSON and get this:
http://www.goodreads.com/book/title?f...
Totally different stuff for "reviews_widget"