1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to scrape this data?

Discussion in 'Programming' started by Egnited, Feb 25, 2010.

  1. #1
    I want to, on my website, display the number of followers that Ashton Kutcher has on Twitter.

    The page I want to scrape the info from is: http://twitter.com/users/show/aplusk.xml

    The specific piece of information that I want to scrape from that page is: <followers_count>[this number]</followers_count>

    Could someone provide me the code for this? I don't think it's very difficult, since I'm just looking to scrape everything from "<followers_count>" to "</followers_count>".

    Thanks a lot for any help!
     
    Egnited, Feb 25, 2010 IP
  2. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #2
    <?php
    
    preg_match("/<followers_count>([0-9]*)<\/followers_count>/", file_get_contents("http://twitter.com/users/show/aplusk.xml"), $matches);
    
    echo $matches[1];
    
    ?>
    PHP:
    :)
     
    danx10, Feb 25, 2010 IP
    Egnited likes this.
  3. Egnited

    Egnited Well-Known Member

    Messages:
    792
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    110
    #3
    You're awesome! Thanks!

    Rep+
     
    Egnited, Feb 25, 2010 IP