You are not formatting the GET request correctly and TwitterOAuth
automatically parses the JSON response for you.
<?php
/* Load required lib files. */
require_once('twitteroauth/twitteroauth.php'); /* This is the
library for connecting with oAuth */
require_once('config.php'); /* This is the file that contains
the oAuth credentials - this will be different for each app */
//$twitterUser = 'YOUR_FRIENDS_USERNAME';
$twitterUser = $field_twitter_url;
/* Create a TwitterOauth object with consumer/user tokens. */
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
OAUTH_TOKEN, OAUTH_TOKEN_SECRET);
$statuses = $connection->get('statuses/user_timeline',
array('screen_name' = $twitterUser'));
Abraham
-------------
Abraham Williams | Hacker Advocate | abrah.am
<http://abrah.am>Just launched from Answerly <http://answerly.com>:
InboxQ<http://inboxq.com>for Chrome
@abraham <https://twitter.com/abraham> | github.com/abraham | blog.abrah.am
This email is: [ ] shareable [x] ask first [ ] private.
On Fri, Mar 25, 2011 at 14:50, Jon <[email protected]> wrote:
> Hello,
>
> I am having trouble with the below code... I am trying to pull a
> user's timeline. Can someone please let me know where I've gone wrong?
>
> <?php
> /* Load required lib files. */
> require_once('twitteroauth/twitteroauth.php'); /* This is the
> library for connecting with oAuth */
> require_once('config.php'); /* This is the file that contains
> the oAuth credentials - this will be different for each app */
>
> //$twitterUser = 'YOUR_FRIENDS_USERNAME';
> $twitterUser = $field_twitter_url;
>
>
> /* Create a TwitterOauth object with consumer/user tokens. */
> $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET,
> OAUTH_TOKEN, OAUTH_TOKEN_SECRET);
>
> $xml = $connection->get('statuses/user_timeline.xml?screen_name=
> $twitterUser');
> $xml = new SimpleXMLElement($xml);
>
>
> Thanks,
>
> Jon
>
> --
> Twitter developer documentation and resources: http://dev.twitter.com/doc
> API updates via Twitter: http://twitter.com/twitterapi
> Issues/Enhancements Tracker:
> http://code.google.com/p/twitter-api/issues/list
> Change your membership to this group:
> http://groups.google.com/group/twitter-development-talk
>
--
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group:
http://groups.google.com/group/twitter-development-talk