Facebook graph API unknown http error - facebook

I am attempting to use the Facebook JS sdk to retrieve my friends list via FB.api("/me/friends") , but I keep getting the following error: {"type":"http","message":"unknown error"}
When I view the request in Chrome debugger tools it shows the request as failed, but copying the url and going to it in a new window pulls down my friends list data as expected.
Has anyone seen this before?

This was caused by the Avast security plugin blocking social networks.

I also had this problem and it seems that Facebook doesn't like if you put the protocol on the app domain and site url fields inside app settings. I had https://blabla.... Removing the protocol solved the error for me.

Related

Failed to get composer template data

Few of our websites like womens-health.com.my, mens-health.com.my, and elle.my having problem post any article to Facebook. When I test any URLs of these websites in Facebook Debugger, it gave me warning messages said that Failed to get composer template data. and Critical Errors That Must Be Fixed. I have no idea what causing this as other of our websites are working fine.
It's an actual Facebook bug, which is being fixed right now: https://developers.facebook.com/bugs/918385908182634/
In summary, you can fix this by making sure that article:author only contains Facebook user IDs or Facebook profile URLs.

Bad HTTP Response code; Facebook likes don't post to facebook

I've created post-specific like buttons on my wordpress website. They appear to work on my site and record likers etc, but nothing posts to facebook. I've tried several wordpress plugins. and all gave the same result. Twitter is working just fine. Upon debugging in the facebook open graph, I get "Bad Response Code URL returned a bad HTTP response code." (more info in the debug link below). What am I missing? Thanks in advance!
The posts can be viewed at http://www.nebulusentertainment.com/news.
You can check out my attempt at debugging here:
https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.nebulusentertainment.com%2Fjust-around-the-corner
Despite the page URL loading in the browser, they are loading with a status code of 500 - Internal Server Error; which Facebook will reject. Since you are using PHP, the fastest solution may be to turn error reporting on, and display errors on. Or take a look at your logs to see what's causing the 500 error.
You can see that your page quits outputting code are about line 328, which looks like it may be an error in the wordpress theme files somewhere (maybe single.php?).
Hope this helps.
The other reason would be, Facebook cannot access your webpage. probably because of your DNS entries or your server is behind a firewall for example your company LAN. Solution: Fix your DNS or Firewall blockages and make sure public social medias like Facebook has access to your sites.
I had the same issue, but after I disabled my cache plugin "W3 Total Cache" everything worked fine .

(#100) link URL is not properly formatted when posting to a facebook page

I am trying to post a URL to a facebook page. using PHP SDK.
I am able to post successfully from my localhost. But on the live server, I get the result "Sorry, something went wrong".
when running the code from live server, I have no problem obtaining access_token to post to the page.
Only the posting will not work.
I tried to post the link manually using the graph api explorer. and found that
I am ABLE to post a message successfully via the graph api explorer.
I am NOT able to post a URL via the graph api explorer. I get the error
"(#100) link URL is not properly formatted"
I do encode the link that i am trying to post. and they are valid, existing links.
I even tried using http%3A%2F%2Fgoogle.com , and it would return the same error.
Some Other information
The code is executed from mydomainname.com/folder/
I have added the domain name to "App Domains" field.
Sandbox Mode is On.
When I tested from my local, I was able to post 25 links to the
page.[after which it was giving errors]. When things were not
working at the live server, I came back to locahost to again test
with 25 links and more and found things to be working fine from
localhost. I wonder if I hit some limit or my application has been
black listed.
Anyone has got any ideas?
Thanks
UPDATE
I took the URL that was used by the live server (to post link to the facebook page) , and used fiddler to post it from my local machine. and it worked.
so i am wondering whats preventing the code from working successfully from the server?
I tried the same code from another domain and it worked.
I am yet to find out if it was not working because of the way the 1st domain was sending CURL requests, or if the domain was blacklisted for posting too much in the past.
either way, facebooks error messages are not at all helpful!
If you're using your own wall, notice the difference between:
"me/feed" and "me/photos" url. The first one doesn't work!!!
I also tried the same thing but unfortunately it works for online images but not for local ones. i.e
'picture' => class_exists('CurlFile', false) ?
new CURLFile($photo, 'image/jpg') : "#{$photo}",
will not work, but
'picture' => "http://i.stack.imgur.com/VGWZD.jpg?s=24&g=1",
will work
I also had some problems with this. Weirdly enough it only worked when I sent the url to the picture without any URL encoding via the POST request to the Graph API.
Try the link without the quotation marks "". I was stuck as you but not any more without the quotation marks.

Graph API not working in older IEs

I can't seem to get the Facebook Graph API to work in IE7, IE8, and Opera while it is working fine in FF3.6, FF8, IE9, and Chrome.
I am following the Client-side Flow from the Facebook authentication docs.
I have a Facebook Connect link and when the user clicks on it the page is directed to:
https://www.facebook.com/dialog/client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&response_type=token
The user logs in and authorizes the app if needed.
The redirect_uri page gets the access_token back just fine. I then try to do an ajax get for https://graph.facebook.com/me to just return the public data (I need name and id).
The request does not succeed.
Doing some research and finding this stackoverflow post I tried changing the ajax response type to 'text/javascript' (also tried several others). Same issues occurs.
Removing ajax from the equation I try to hit the API directly with the browser (not logged into Facebook and without an access_token) like this example from Facebook Graph API Reference page.
https://graph.facebook.com/btaylor
I can view it fine in FF. I can download and then view it fine with IE9. I get this error in IE8:
Unable to download btaylor/ from graph.facebook.com.
Unable to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.
While searching for answers I found this stackoverflow post, and sure enough Facebook's Graph API Explorer does not work in IE8.
I can't find much else on this topic which seems to say I am doing something horribly wrong. Or have developers given up on IE < 9?
A straight up GET request doesn't work in IE 8 because IE 8 can't understand the JSON format that the data is coming back in and so it crashes. For the AJAX response, you should set the AJAX reponse to application/json, not text/javascript. Is there a reason you can't just use the Facebook JS SDK? For example:
FB.init({ // options });
FB.api('/me', function(response)
{
// do stuff
});
I'm not actually sure why the Graph API explorer isn't working in IE 8, but for me, the explorer throws Javascript errors but doesn't crash the browser, while loading a Graph response via a GET results in a browser crash.
I think this is most likely just a typo on your part for the question, but the correct Facebook authorization URL is:
https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&response_type=token
Other than that, I really can't see anything else that you are doing wrong. Looks like IE8 is on its way out.

How to do wall post in WAP based facebook mobile app?

I'm doing a facebook application for (WAP based)mobile browser. I need to show the post dialog. When i use the following code for wall post it show error.
http://m.facebook.com/dialog/feed?app_id='.$app_id.'&redirect_uri=$redirect_url&display=wap
The error is:
API ERROR CODE:3
API Error Description: Unknown Method
Error Message: This method isn't supported for this display type
While I give display type as 'touch' in the above mentioned URL it works fine in the touch devices. But no form displayed in the wap browser.
That's strange, because their documentation does mention that is the method to do it: http://developers.facebook.com/docs/reference/dialogs/
I notice an error in your PHP though (unclosed apostrophe):
It should be:
'http://m.facebook.com/dialog/feed?app_id='.$app_id.'&redirect_uri='.$redirect_url.'&display=wap'
Here is a similar issue on https://github.com/facebook/facebook-android-sdk/issues/177
Also, check out facebook's bug tracker: http://bugs.developers.facebook.net and perhaps file your bug there and then link to it from here.