Wednesday, 21 March 2007
Find an Easy Way to Scrape Details from a Myspace Profile Page with PHP |
| |
|
| |
Meshach in a post over at WaxJelly shows you how to find an easy way to scrape details from a Myspace profile page with PHP. He says, a little optimization on the part of Myspace makes crawling their site easier. He scrapes the user detail that is name, age, sex, and such from a profile, using the header info like the following:
First he sets the myspace URL:
$your_profile_url = ‘http://www.myspace.com/waxjelly’; Then he creates the file using the ‘file()’ function. He wants an array, so that he can crawl it and use ‘trim()’ to clean it up. He gives the following code:
$file = file($your_profile_url);
He sets up a string and loop through the profile array to clean it up. To facilitate the process he gives the following code:
$profile = ”; for ($i=0; $I<count($file); $i++) { $profile .= trim($file[$i]); }
The rest of the work is carried out by using simple explode functions. He says, he is looking for the ‘ The rest of the article, he explains with examples codes and he highlights the best part of this script—Myspace prints the element even if it’s blank.
You can get a working version of the script here.
|
| |
|
Read the Post
|
| |
|
|
| |
|
|
| |
|