Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

get twitter updates question [php]

  • 23-07-2011 6:06pm
    #1
    Registered Users, Registered Users 2 Posts: 648 ✭✭✭


    hi

    im using php and curl to get twitter updates of a specific user

    however i want to know if i can get the updates of several users in one call to twitter ?

    tnx




    heres an example of the curl script im using :

    [PHP]
    function get_status($twitter_id, $hyperlinks = true) {
    $c = curl_init();
    curl_setopt($c, CURLOPT_URL, "http://twitter.com/statuses/user_timeline/$twitter_id.xml?count=1");
    curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
    $src = curl_exec($c);
    curl_close($c);
    preg_match('/<text>(.*)<\/text>/', $src, $m);
    $status = htmlentities($m[1]);
    if( $hyperlinks ) $status = ereg_replace(":alpha:+://[^<>[:space:]]+[[:alnum:]/]", '<a href="%5C%22%5C%5C0%5C%22">\\0</a>', $status);
    return($status);
    }
    [/PHP]
    Tagged:


Comments

  • Registered Users, Registered Users 2 Posts: 26,584 ✭✭✭✭Creamy Goodness


    don't think you can make multiple user requests to twitter like you want to.

    stick it in a loop like so.

    [php]
    $twitterUsers = array('stephenfry', 'ladygaga', 'boards_ie'); //etc.

    $results = array();
    foreach($twitterUsers as $tweeter)
    {
    $results[$tweeter] = get_status($tweeter);
    }

    print_r($results);
    [/php]


  • Registered Users, Registered Users 2 Posts: 182 ✭✭fugee


    why not use the twitter widget

    http://twitter.com/about/resources/widgets/widget_search

    Very neat and updates as often as you set.


Advertisement