trying to fetch user tweet stream in php - php

I am using the following code, but it showing a 404 error
$url = "http://api.twitter.com/version/statuses/user_timeline.json";
$call = file_get_contents($url);

There's no 'version' version. The Twitter API is currently version 1, so you need http://api.twitter.com/1/statuses/user_timeline.json.
Do note that Twitter can't read your mind, so you'll need to tell Twitter which user's timeline you want to fetch... i.e. http://api.twitter.com/1/statuses/user_timeline.json?screen_name=ceejayoz

Related

Facebook Users Search API

I am using latest version of facebook php sdk i want searched user list.
$response = $fb->get('search?q=programming&type=user', '{access-token}');
$response is always returns blank value in version 5.
Thanks in advance..!!!
That was removed in 4/2018 already.
https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#search-4-4
You can no longer use the /search endpoint with the following object types:
event
group
page
user

Infusionsoft Getting Tags

I am new to the Infusion API and I have a couple of questions that I am unable to find a specific answer to.
I have used the PHP SDK and installed via composer
1) Within the new API is there away that I can view all tags that have been created?
2) I have created and got my client clientId and clientSecret via but I am unsure how I connect it to the app name that I want to fetch the tags for.
I have given it an attempt by looking at code examples I have seen via Google however I am getting the following error - Call to undefined method Infusionsoft\Infusionsoft::dsQuery()
Code:
<?php
//Connect to the Infusionsoft API
require_once 'vendor/autoload.php';
$infusionsoft = new \Infusionsoft\Infusionsoft(array(
'clientId' => 'key',
'clientSecret' => 'key',
));
// Fetch the required tags for this place
$getFields = array('Id','GroupDescription', 'GroupName');
$query = array('GroupName' => '%');
$tags = $infusionsoft->dsQuery("ContactGroup",1000,0,$query,$getFields);
var_dump($tags);
?>
First of all, there's no new API. Improvements are added to Infusionsoft API all the time, but it's still the same updated API. If you mean new Infusionsoft PHP SDK, then example request to get the tags looks this way:
$infusionsoft->data()->query('ContactGroup', $limit, $page, $queryData, $selectedFields, $orderBy, $ascending);
query() method is implemented in Infusionsoft/Api/DataService.php file
You connect to a specific Infusionsoft account during oAuth authorization flow. This basic flow is shown, for example, in PHP SDK examples
The error you see means exactly what it says - there's no such method dsQuery() in the updated SDK. The link to the SDK code where you can see all available methods was provided in the first point.

facebook php sdk get events from facebook page via graph api

1,5 months ago I could make requests to graph api explorer and everything was ok. Suddenly, without changing anything in the code I got this error message when I tried to access the event node of a facebook page in graph api:
Undefined index: events.
I have this code which works fine:
$request1 = new FacebookRequest($session,'GET','/'.$key.'?fields=name,cover,events');
$response1 = $request1->execute();
$graphObject1 = $response1->getGraphObject()->asArray();
$array1 = json_decode(json_encode($graphObject1),true);
$source = $array1['cover']['source'];
I can take the cover photo but when I try this :
$request2 = new FacebookRequest($session,'GET','/'.$key.'/events');
$response2 = $request2->execute();
$graphObject2 = $response2->getGraphObject()->asArray();
$array2 = json_decode(json_encode($graphObject2),true);//$key is the page id
$temp = $array2['data'];
I got this error:
Undefined index: events
please help!!
You need to make it a version request. Facebook updates it's API on a regular bases. But they let you use the old version if you make a version request. This way you do not have to worry about the API being updated.
Here is a resource from Facebook on how to go about doing that.
https://developers.facebook.com/docs/apps/versions

Facebook PHP API not always returning event venue data

I have 3 events:
https://www.facebook.com/491594114271958 (Mad Haus)
https://www.facebook.com/569226999799343 (Deuglish)
539504962802119/ (Piffle)
All are being fetched via the PHP
$config = array();
$config['appId'] = $appId;
$config['secret'] = $secret;
$config['fileUpload'] = false; // optional
$facebook = new Facebook($config);
$ev = $facebook->api('/'.$id."?fields=cover,description,location,name,owner,venue",'GET');
print_r($ev);
For some reason Mad Haus and Piffle do not return venue data but Deuglish does. All events return basic data such as title, description and start time. When I run them through the Graph API explorer the venue data is returned as expected but not through the PHP API, any ideas? I can not for the life of me see the difference with these 3 events.
Thanks,
Caroline
Well, if you don't want to wait for the Facebook developers to fix the bug, you can try the same by making a simple GET request (of course along with an Access Token) to Graph API using PHP cURL. Since you are able to retrieve the venues while using the Graph API explorer, I'm pretty sure you'll be able to get them by making a simple GET request using PHP cURL.
This however involves an overhead of parsing the received JSON object and dealing with errors will be a little difficult here. But you can give it a shot.

Facebook Photo Upload into Album on Fan Page failed

I have written an Application what posts Photos on a FanPage into a Specific Album long time ago.
Now I didn't used for a half year. Now I had to set up the Application again and grant the extended Permissions to the Fan Page (streamm_publish) again.
But now I've a Problem, I'm using the old REST API what now gives me the error: An unknown error ocurred with the error code 1.
Then I tried to post throught the Facebook Graph api.
I tried to make a call to the Api /pageid/albumid/photos what's not working(Unknown path components)
I tried to makea a call to /albumid_from_my_page/photos then the Photos were posted to my profile
I tried to upload it to /pageid/photos what is the same as the one above
But the code fpr the REST Api worked well, what's the problem there, and why the new Graph Api isn't working how she should?(BUG?)
To post a photo to an album, this is the code:
$post_data = array(
"message" => "My photo caption",
"source" => '#' . realpath($file)
);
$album_id = "XXXXX";
$facebook->api("/$album_id/photos", 'post', $post_data);
Now I suppose to interact with the page albums you need a page access_token added to your $post_data array, for this check this answer.
You need take ACCESS_TOKEN page...
try:
http://graph.facebook.com/me/accounts?access_token= GET THIS TOKEN USING GRAPH API... OR MAKE USING the getAccessToken()...
and will see all pages and aplications that u have, find just application for this case and COPY TOKEN... and damn!!!
It's possible to see this token thought GRAPH API EXPLORER...
regards.

Categories