pulling mentions from twitter with php

I am trying to retrieve mentions from twitter using php. The current code I have works fine to retrieve the user_timeline, however when I try to use the same code for the mentions I get an authentication error. What is the best way to retrieve mentions with userid, pictures, text, etc included?

if I change user_time to mentions I get an authentication error.

Here is the code I use now to retrieve user_timeline with php.

<?php

$xmldata = "http://twitter.com/statuses/user_time/usernid.xml";

$open = fopen($xmldata,'r');

$content = stream_get_contents($open);

fclose($open);

$xml = new SimpleXMLElement($content); 

$screenname = $xml->status[0]->user->screen_name;





?>

Answers


You have to use OAUTH ("Returns the 20 most recent mentions (status containing @username) for the authenticating user."):

https://dev.twitter.com/docs/api/1/get/statuses/mentions

Try: https://github.com/abraham/twitteroauth or http://www.joeyrivera.com/2010/twitter-api-oauth-authentication-and-zend_oauth-tutorial/ and https://dev.twitter.com/apps/new


Need Your Help

How to fix error “Expected version spec in …” using pip install on Windows?

python windows

On a Windows 7 machine I am using the following command to install a package from a local directory:

Database in use error with Entity Framework 4 Code First

sql entity-framework code-first ef-code-first

I have an MVC3 and EF 4 Code First application, which is configured to change the DB when the model changes, by setting the DB Initializer to a DropCreateDatabaseIfModelChanges&lt;TocratesDb&gt;, w...