Twitter Scraping

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shanehunter
Forum Commoner
Posts: 30
Joined: Sun Jun 27, 2010 3:43 pm

Twitter Scraping

Post by shanehunter »

Hey Guys,

I have no idea HOW to do this, or whether or not it's even possible...

On the right hand side of a twitter account page, there are the current trends: ie: Mick Jagger, Kobe Bryant, Lebron James etc... They are all enclosed in name=" " tags. I want to be able to randomly extract one of the names (randomly every time is different) to a php script that I can later echo.

Anyone know how I can go about doing this?
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Twitter Scraping

Post by Jonah Bron »

Regex or DOM. Probably regex. Look at the source and make a pattern. Use preg_match_all(), and randomly pick one of the results with array_rand().

Are you sure the Twitter API doesn't provide something for this?
Post Reply