简体   繁体   中英

[function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request

I have an error while logging a user to my application using facebook login. I found similar question in previous answered question but when I apply I still have the same error. The question was clear and You can check it here .
Can anyone who had the same problem try to help me to add the exit statement as it was answered in above told question.

You should use Facebook (PHP) SDK

http://developers.facebook.com/docs/reference/php/

The Facebook SDK for PHP provides a rich set of server-side functionality for accessing Facebook's server-side API calls. These include all of the features of the Graph API and FQL.

It can only be said time and time again:

Using the PHP SDK makes dealing with the API a lot easier, than doing things “manually” with file_get_contents. So please consider using that instead, for your own benefit.


When file_get_contents used with HTTP URLs gets something other than a 2xx HTTP response code, it generates just a warning, and does not give you the HTTP response body, which in those cases usually contains the actual reason for the error.

To get this body and therefor the actual error message, you have to use file_get_contents with a context parameter with the HTTP context option ignore_errors set to true.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM