Thanks again, but now am getting:
Warning: Invalid argument supplied for foreach()

It looks correct to me, so I'm confused about the warning.

Thanks
Lorraine

On Fri, Oct 1, 2010 at 3:54 AM, Abraham Williams <4bra...@gmail.com> wrote:

> You don't need the cURL and XML code.
>
>  require_once('twitteroauth.php');
> $connection = new TwitterOAuth('consumer key', 'consumer secret', 'access
> token', 'access token secret');
> $tweets = $connection->get('statuses/friends_timeline');
> $latesttweets = count($tweets);
>
> foreach ($tweets->status as $tweet) {
>   echo  $tweet->text;
> }
>
>
> Abraham
> -------------
> Abraham Williams | Hacker Advocate | http://abrah.am
> @abraham | http://projects.abrah.am | http://blog.abrah.am
> This email is: [ ] shareable [x] ask first [ ] private.
>
>
> On Thu, Sep 30, 2010 at 11:38, Lorraine <lorrainema...@gmail.com> wrote:
>
>> Thank you so much, Abraham! I'm getting an error "String could not be
>> parsed as XML" now- this is what I now have (with my reset consumer keys put
>> in :-)):
>>
>>
>> require_once('twitteroauth.php');
>> $connection = new TwitterOAuth('consumer key', 'consumer secret', 'access
>> token', 'access token secret');
>> $tweets = $connection->get('statuses/friends_timeline');
>> $latesttweets = count($tweets);
>>
>> $tw = curl_init();
>> curl_setopt($tw, CURLOPT_URL, $tweets);
>> curl_setopt($tw, CURLOPT_RETURNTRANSFER, TRUE);
>>
>> $twi = curl_exec($tw);
>> $tweeters = new SimpleXMLElement($twi);
>>
>> I then go on to grab data using
>> foreach ($tweeters->status as $twit1) {
>>
>> etc.
>>
>> Thanks again,
>> Lorraine
>>
>> On Fri, Oct 1, 2010 at 2:13 AM, Abraham Williams <4bra...@gmail.com>wrote:
>>
>>> Make sure you reset your consumer key on http://dev.twitter.com/apps and
>>> try not to post them in public in the future.
>>>
>>> This should work. I switched it to json as it didn't look like you needed
>>> the actual xml and dropped the count as 20 is the default.
>>>
>>> require_once('twitteroauth.php');
>>> $connection = new TwitterOAuth('consumer key', 'consumer secret', 'access
>>> token', 'access token secret');
>>> $tweets = $connection->get('statuses/friends_timeline');
>>> $latesttweets = count($tweets);
>>>
>>>
>>>
>>> Abraham
>>> -------------
>>> Abraham Williams | Hacker Advocate | http://abrah.am
>>> @abraham | http://projects.abrah.am | http://blog.abrah.am
>>> This email is: [ ] shareable [x] ask first [ ] private.
>>>
>>>
>>>
>>> On Thu, Sep 30, 2010 at 02:38, Lorraine <lorrainema...@gmail.com> wrote:
>>>
>>>> Maybe I should explain what I'm trying to do-- basically just want to
>>>> get my own status updates and the (public) details & updates of my
>>>> friends.
>>>>
>>>> Would it work if I replaced this:
>>>> $login = "mytwitterusername:mytwitterpassword";
>>>> $tweets = "http://twitter.com/statuses/friends_timeline.xml?count=20";;
>>>>
>>>> with this?:
>>>>
>>>> require_once('twitteroauth.php');
>>>> $connection = new TwitterOAuth('6Oe8P3U72LimBkfGsj0h1A',
>>>> 'XVX67blKxfro001KDq1PZLV6QwZ5Et1TnmeVBexMqI', '769601-
>>>> PXr5egoxYccGKnua9cg58QNfVMIyiXsEFUtkOPoH0',
>>>> 'P7JiGIKvMg8TsaKgxU9azAi8cZwerZyshu1VHwoPbD8');
>>>> $connection->format = 'xml';
>>>> $tweets = $connection->get('statuses/friends_timeline.xml?count=20');
>>>>
>>>> $tw = curl_init();
>>>> curl_setopt($tw, CURLOPT_URL, $tweets);
>>>> curl_setopt($tw, CURLOPT_RETURNTRANSFER, TRUE);
>>>>
>>>> $twi = curl_exec($tw);
>>>> $tweeters = new SimpleXMLElement($twi);
>>>> $latesttweets = count($tweeters);
>>>>
>>>> ... or am I completely off the mark?
>>>>
>>>> Thanks very much :)
>>>> Lorraine
>>>>
>>>> --
>>>> 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
>>>
>>
>>  --
>> 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
>

-- 
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

Reply via email to