I am experiencing a very strange error (could be a bug). I am trying to post a photo to a TEST USER. The first request I make goes through perfectly and the photo gets posted, but the 2nd, 3rd, etc. requests I make I get the following error:
"An unexpected error has occurred. Please retry your request later."
It is important to note that this is only an issue with TEST USERS. Normal users work perfectly for any number of requests. It is also important to note that this worked perfectly with TEST USERS for multiple requests about a week or two ago.
I am using the PHP SDK and post the photo using the following code:
// Create tag array
$tagArray = array(array('tag_uid' => $posterUid, 'x' => 0, 'y' => 0));
// Post the photo
$fb->setFileUploadSupport(true);
return $fb->api(
"/$posterUid/photos",
'POST',
array(
'access_token' => $accessToken,
'message' => $message,
'source' => '#' . $source,
'tags' => $tagArray
)
);
I have tried posting different photos and also tried deleting and recreating TEST USERS, but the problem persists.
I had a similar problem and it was driving me crazy. I was finally able to get it to work by turning off 'sandbox' mode on my developer application.
I have no idea why this made a difference. But it fixed the problem for me. Hope this helps someone.
Related
I'm trying to develop a Play Store reviews scraper in PHP and I need to make a POST request to this URL https://play.google.com/store/getreviews, and I saw the parameter post with firebug.
I am using Goutte library and here is my code:
require_once 'goutte.phar';
use Goutte\Client;
$client = new Client();
$params = Array(
"id" => "com.trello",
"pageNum" => 2 ,
"reviewSortOrder" => 2 ,
"reviewType" => 0,
"xhr" => 1
);
$crawler = $client->request('POST' , 'https://play.google.com/store/getreviews', $params);
The problem is that the request returns nothing. Is there anyone who already faced this problem and solved it?
I don't think this is possible. Google Play changed their review interface last year. They now have a "token" parameter which is missing here. I have worked before to try and work out what seeds this (see Google play review scraping changes) but I can't figure it out. After a number of attempts to hit that webservice with an incorrect request (presumably without the token) Google Play starts blocking your IP, that's why you'll be getting nothing back after a while (and won't be able to open Google Play in your browser either). If you find a solution, let me know!
This URL works for me, with the form-post data in your example.
https://play.google.com/store/getreviews?authuser=0
I created a tool for our support team that gets all private messages from our +/- 70 Facebook fan pages for easy processing and not having to manually click through all the pages to check if there are new or unanswered messages.
This tool worked perfectly for a couple of months but recently we've been getting the following error when trying to send a reply on a private message:
[error] => Array
(
[message] => (#504) Invalid reply thread id
[type] => OAuthException
[code] => 504
)
My code is as follows:
$fb->setAccessToken('%access_token%');
$edge = 't_id.' . $thread['id'] . '/messages';
$result = $fb->api($edge, 'POST', array('message' => $message));
I use extended access tokens but just to be sure I renewed them all. The value in $thread['id'] is the value from 'thread_id' from querying FQL 'message' table.
I searched in the Facebook docs but it looks like they removed everything concerning this subject, which could imply they removed the functionality entirely.
They say something about a new messages system which they are rolling out on the thread reference page, but I can't find anything else about this subject. https://developers.facebook.com/docs/reference/api/thread/
EDIT:
As you can see in the comments the documentation can be found here: https://developers.facebook.com/docs/graph-api/reference/page/conversations
I just made a new page for testing and I can't seem to get a valid access token in the graph api exlorer for accessing the edge /{page-id}/conversations. I remember this has happened before when I was developing my tool. The same access tokens didn't work for a week and then suddenly started working again...
I just don't know why this fails. I have the following which attempts to add tasks to Asana:
$arrayOfIds = array("0123456789", "9876543210");
$followers = implode('", "', $arrayOfIds);
$newtask = $asana->createTask(array(
"workspace" => $workspaceId,
"name" => $name,
"team" => $teamId,
"assignee" => $assignee,
"due_on" => $dueOn,
"completed" => $completed,
"completed_at" => $completedAt,
//"followers" => array("0123456789")
"followers" => array($followers)
));
It works just fine when I put the user ID in manually, like above commented code, however fails when I try to use the array. I get the following error:
Error while trying to connect to Asana, response code: 400
Any help is greatly appreciated.
Without knowing exactly how the $asana lib is implemented (link?) my guess would be that the array is not encoded correctly. If sent via url-encoded post data (as opposed to JSON) the array should be comma-delimited. PHP may do something else like followers[]=1&followers[]=2 when it should be followers=1,2.
Try doing something like "followers" => implode(",", $arrayOfIds), or check the code of the library to see how it encodes arrays. Additionally, including the actual HTTP request/response would help figure out what's going in. There are many ways to get this - your library may include a verbose/debugging mode, but if all else fails you can always use something like Charles Proxy, Wireshark, Ettercap, etc.
I'm building a Facebook App where the user selects an image that gets uploaded to my App's album for that user. Everything works fine, the picture gets uploaded and posted on the user's wall etc no problems there.
But, after the upload I try to fetch the newly uploaded photo using the ID I get as a response from the upload, and this is where I run into problems. FB simply tells me "Unsupported GET request".
Here's the relevant code I have:
<?php
# Works perfectly fine
$response = $fb->api('/me/photos', 'post', array(
'message' => 'Some message',
'source' => '#' . realpath('path/to/img.jpg')
));
# "Unsupported GET request"... :/ (SOMETIMES ??)
$photo = $fb->api('/' . $response['id']);
All the authentication etc obviously works (otherwise I wouldn't be able to upload at all) it's just fetching the photo that does not work.
I'm using the PHP and JS SDK:s simultaneously and I've tried with both. I started with JS and it never worked. However, the PHP call works sometimes.
Does anyone know what I'm doing wrong?
Edit: Ok so I skipped fetching the newly created photo and instead simply constructed a URL to it using the ID returned from the upload (all I was after was the photo object's link property anyway - I figured it was more future proof to use instead of constructing your own). However, even now when I redirect to http://www.facebook.com/photo.php?fbid=ID_GOES_HERE&makeprofile=1 sometimes (again :P) Facebook will tell me the "content is not available". After a Ctrl+R, however, it is. This seems to me that FB hasn't finished adding the new content even though my $fb->api('/me/photos', 'post'...-call has returned an ID.
Thoughts?
Well for me, it was just because the method to post photo seems to change :
https://developers.facebook.com/docs/reference/api/page/#photos
$facebook->setFileUploadSupport(true);
$picture = "#".realpath('path/to/the/photo');
$result = $facebook->api(
'/fb_id_of_the_page/photos/',
'post',
array('access_token' => 'access_token',
'message' => 'message',
'source' => $picture
)
);
Well, pretty strange because the same thing happen to me.
Work fine and 12 hours ago, completely down. I can't post anymore whereas i've got return id.
When I ask the graph api with the return id I got this :
{
"error": {
"message": "Unsupported get request.",
"type": "GraphMethodException",
"code": 100
}
}
Just to notice it's happe only when I post image. With link or status everything is fine.
Is FB api in trouble?
I use following code to update the status:
$parameters = array(
'message' => "Hey guys check this cool app",
'link' => "http://apps.facebook.com/xxxx",
'name' => "Invitation for xxxx",
'picture'=>"http://localhost:55/xxxx/logo.jpg",
'caption' => "Try xxxx!",
'access_token'=>$at //valid access token
);
try{
$statusUpdate = $facebook->api('/me/feed', 'POST', $parameters);
}catch(FacebookApiException $e){}
This works and after status update, I get an id. But when i go to my profile and check the status update, This is what I see:
. The problems are: (1) Image is not displayed, and (2) Unwanted My first app as shown in figure. Why is this happening? How do i fix it?
http://localhost/... is never going to work as the image location because Facebook won't be able to retrieve it. Put the publicly accessible URL to the image in that field instead.
In the screenshot you posted, the 'My first app' part is the name of the app, you can change this in the app settings. It can't be changed on a per-post basis, all posts from your app are attributed to your app
As far as the image is concerned, check again that the path of the image is correct. If it still does not work, try specifying 'https' instead of http and see what happens