How to extract Twitter username from Search API via PHP

Posted by Alexia on Stack Overflow See other posts from Stack Overflow or by Alexia
Published on 2010-01-09T16:32:20Z Indexed on 2010/04/11 21:03 UTC
Read the original article Hit count: 386

Filed under:
|
|
|
|

The Twitter Search api returns results in ATOM/XML format which look like this:

<author>
  <name>username (Friendly Name)</name>
  <uri>http://twitter.com/username</uri>
</author>

In my PHP I can get the name field as a variable, so it would look like this:

$names = "username (Friendly Name)"

But I want to use PHP to extract them as seperate variables, like this:

$username = "username"
$friendlyName = "Friendly Name" (without parantheses)

TIA!

© Stack Overflow or respective owner

Related posts about php

Related posts about twitter