Facebook graph command creating duplicate album - php

I've been using the Facebook php sdk to interact with facebook quite successfully. When I tried to create a photo album the code created a duplicate. At first I thought it was the php sdk (using 3.x). I tried switching to Perl with LWP::UserAgent and LWP::Simple::Post to use the http url for graph. Nothing is working. Every way I try I get double albums when I call the code. I've ensured that the code is being called once (mainly because I've created a super small test script to do it and have made outputs to ensure on the command line that it's only calling once.
Here's the url I'm using:
https://graph.facebook.com/me/albums?access_token=<access_token>&name=Test+Album+2&message=Test+Description
I've taken off the privacy setting from the url and it hasn't changed the behavior. If I run this directly in the graph explorer, it creates only one album. But any other method (yes, I am using POST and not GET and yes I've tried to pass all the params as post data individually rather than via querystring, either way results in duplicate albums) causes duplicate albums.
Has anyone experienced this? How do I fix it??? I'm at my wits end trying to figure this out.
I've tried it on multiple servers in thoughts that perhaps one of them was using a proxy causing the duplicate call, but whether I run it on my hosting service or on my localhost, I still get duplicates.
No matter what I've tried, if I am creating the album via code in PHP or Perl I get double albums created. HELP!

My first answer was deleted for some reason so I'm not sure what to do at this point. This question can't be answered because:
The issue was not with the SDK but with Facebook itself. I had created a bug report after doing some more tests. Facebook confirmed and fixed the bug. Basically, it had to do with inappropriate permissions handling.
https://developers.facebook.com/bugs/1435856773345641/
There was a bug in Facebook's handling in this instance. I'm hoping this answer doesn't get deleted because someone else may experience this and want to know that it was a bug in Facebook code, not in the PHP SDK or in the user code.
Not sure why Andrew Barber would delete that answer.
Unless someone has a better answer than what Facebook gave to me via bug report follow-up.

Related

How to extract data from facebook api or using php sdk for Job applications?

I did lots of research to find the proper guideline to get a few thing done but seems like really hard. All I am asking is below:
Anyone know in php how to extract posted jobs?
How to get job applications like all the users applied for job?
Where to start my code in php?
I know all below:
business manager id
app id
app secret key from my created app.
but I don't know how to get the pageID?
I have also found this URL to get the job applications: job applpications
but don't know how to perform from the above URL.
Please give me some guideline here as I am completely new to the Facebook API. Also, please if someone can provide me some starting point of php code to begin with my 1st and 2nd question.
Also if you check below image then it's showing that you can get applications from job:
There is no publicly available Jobs API. Reading job posts via the /feed endpoint is also not supported.

Sending a PUT request from PHP to Hubspot

This problem is really bugging me, i'm a hobby programmer who right now is trying to follow the simple instructions of Hubspots CRM API documentation.
I've managed to retrieve and POST information from and to Hubspot using cURL/PHP, but now i'm facing an update(PUT) and i can figure it out.
I'm trying to associate a "Deal" with a "Contact" inside the CRM, it seems to be so easy, just fire away a url? :)
The documentation on the API says:
Note: You only need to use this endpoint when updating existing deal records. If you are creating new deals, you can make these associations when creating the record by including the associations data as documented on the create deal page."
src: https://developers.hubspot.com/docs/methods/deals/associate_deal
Do i understand correctly, i tried to use this URL in my browser and expected an update to happen?
https://api.hubapi.com/deals/v1/deal/DEALID/associations/CONTACT?id=CONTACTID&hapikey=MyKey
The response i got in the browsers console was: 405 (Method not allowed).
I tried to fire the url though cURL aswell, but got lost right away because i dont really have any data to send in "CURLOPT" parameters, the data should, if i understand correctly be inside the endpoint url.
If you have any idea of what this hobby programmer doesnt understand, please reply :)
Kind regards,
Simon

Searching twitters public timeline using JQuery

So a while back I used to use the twitter json search in one of my apps but it seems since the change in API versions there has been some major changes which even after reading the documentation I still can't get my head around and it really doesn't make it very easy to understand so hopefully one of you tech guys out there can help me out.
I want to clean my application up so it works again in plainly doing the following:-
http://search.twitter.com/search.json?
q='+param+'&
rpp=100&
result_type=recent&
lang=en
Obviously with the changes this is no longer possible but I want to be able to do this again using the new address but in JQuery unless someone can suggest either a tutorial or a piece of code or even a link to a topic where I could get my answer. I'm also open to using PHP as this is what I used at one point with searching Facebook's timeline and you can get an access token using $.get() for Facebook so surely it would be the same with Twitter too?
Any advice/code is welcome.
Thanks!
the search API needs authorization now. I'd say that, first off, you need to call the https url not http.
With Abhramam William's library you'd do something like the following, after having received your app's bearer token:
$your_tweets = $connection->get("https://api.twitter.com/1.1/search/tweets.json?q=from:grey_mina&result_type=recent&count=5");

Setting a groups cover image using the Facebook Graph API

I've been visiting this forum for years, but this is my first ever question. Any help would be appreciated!
I am writing a web service to pass groups from one application into Facebook and invite the authorised people into them and set a nice pretty cover photo that is generated and stored within the application.
The group creation works splendidly after a fair old bit of head scratching, however, when I try to set the cover image, I am getting a rather useful error message back as below.
OAuth "Facebook Platform" "unknown_error" "An unknown error has occurred."
It's a PHP application on Code Igniter. According to Facebook's delightfully accurate API documentation, this is a simple matter of a cUrl post to 'graph.facebook.com/$groupId' passing the same auth token I just used to create the group and perform the invites and a single JSON encoded parameter of 'cover_url' => $urlOfImage .
A simple task in theory, however, I have spent all day today and a significant chunk of yesterday trying to get this to work without much success.
I have tried posting the image as a Curl object as is necessary in other areas of the Facebook API, and it appears to be trying giving me an error that the image is generating a 404 error (it isn't, when I checked the access logs, it was never requested).
Please be someone out there who has had some success with this.
This has now been fixed by Facebook

Facebook Application and posting to a Page Stream

As usual, I'm having problems due to a lack of clear guide in the Facebook API Documentation.
Basically I have created an application that is installed to Facebook Pages, I want to periodically post automatically via my server to the Stream of these pages (of course, willing to have it authorised, etc), but I am just unable to find how to do this. I've looked at stream write, etc, but not sure how to best make use of this. I've looked at Extended Permissions, should this simply just work for Pages? I'm experimenting but not having too much luck at the moment.
Any ideas guys? Also, am I able to make use of the new "targetting" of users that Page administrators have when posting to a Page now?
Sorted out my previous problem, simply now wondering whether I can location target posts as Page admins are now allowed to do.
I am using PHP with the latest library updates btw.
Big thanks!
The way to post feed stories/streams is to use stream.publish function, check it out here:
http://wiki.developers.facebook.com/index.php/Stream.publish
And for automated publishing, you need to use cron job, here is how to get started with that:
http://www.aota.net/Script_Installation_Tips/cronhelp.php3

Categories