Goodreads Developers discussion
bugs
>
php file_get_contents fails
date
newest »


What's the response body?

What's the response body?"
$response is blank because the function fails with the 400 error. I'm going to try curl but am having some issues getting it installed on my server VM. I may have to upgrade the OS first.

Can you email me a sample url containing your key to support@goodreads.com (mention my name).
That would help me diagnose a little more.

Can you email me a sample url containing your key to support@goodreads.com (mention my name).
That would help me diagnose a little more."
Done. Should be able to test curl tomorrow.

Can you email me a sample url containing your key to support@goodreads.com (mention my name).
That would help me diagnose a little more."
Server upgrade was fairly painless; once curl was installed, it works. For future reference there is a drop-in function replacement for file_get_open at http://snipplr.com/view/51161/basic-c.... I think based one some other reading while waiting for the server to upgrade is that is likely the agent setting, which spoofs the web service into thinking it is a browser doing the calling. Strictly speaking, that shouldn't be necessary. But curl facilitates this parameter. At least that's my guess. File_get_open should work.
[function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 400 using some simple php, as follows:
$request="http://www.goodreads.com/book/title?t...
$response=file_get_contents($request);
I've verified that $request works when manually entered into a browser. Why might I be getting a 400 error and what might be the workaround?