Domanda

I am not a hardcore coder but i have small knowledge i have attempted to fix this error we are getting regarding the Twitter api

there is a line of code that checks that a twitter name is currect which is sent via a form

$url = get_data("http://api.twitter.com/1/users/lookup.json?screen_name=".$name);
$xml = json_decode($url, true);
$id = $xml[0]['id'];
$av = $xml[0]['profile_image_url'];
if ($id != "")

What i understand

I understand that this version of twitter is no longer available and i need to update it to 1.1

What searching and research i have done

I have Searched the net for a quick answer for this but was not able to find any....

I have found this code https://github.com/abraham/twitteroauth/tree/master/twitteroauth

My question

How do i adapt the files to work within this file? i didnt post the whole code within the page as im not sure all of it is relevant.

È stato utile?

Soluzione

Just use the 1.1 in the URL. That will do

http://api.twitter.com/1.1/users/lookup.json
                -------^

Do like this...

$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN,OAUTH_SECRET);
$account = $connection->get('account/verify_credentials');
$status = $connection->post('statuses/update', array('status' => 'Text of status here', 'in_reply_to_status_id' => 123456));
$status = $connection->delete('statuses/destroy/12345');

Documentation

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top