Page 1 of 1

scrape and display on the fly ???

Posted: Wed Dec 26, 2007 11:50 pm
by wesnoel
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Well I have been searching for this all night to no avail. 

What I am looking for is the ability to scrape the first 25 user images on the myspace browse page here: [url]http://browseusers.myspace.com/Browse/Browse.aspx?z=1[/url] and then display them along with a link back to the user profile myspace. 
If I get pointed in the right direction I might be able to hack my way through some code snippets if anyone wants to offer some up.

No DB or anything just on the fly scraping if possible.


[b]This is one image[/b]
[syntax="html"]
<div id="ctl00_cpMain_Browse_skin_ResultsView_browseList_ctl03_photoNameOnlyItemView" class="alignC">
			
				<a href="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=283903034" id="ctl00_cpMain_Browse_skin_ResultsView_browseList_ctl03_pnDisplayName">jenny</a>
				<br>
				<a href="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=283903034" id="ctl00_cpMain_Browse_skin_ResultsView_browseList_ctl03_pnImg">
					 <img src="http://a232.ac-images.myspacecdn.com/images01/22/s_9b5317894443f786b8ee898d25b4394f.jpg" id="ctl00_cpMain_Browse_skin_ResultsView_browseList_ctl03_pnImgTag"></a>
				<br>
				

<br>
				<br>
		  
		</div>


Cheers and thank to anyone that can help.

Wes/


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Thu Dec 27, 2007 10:08 am
by Jonah Bron
Okay, correct me if I'm wrong, but I think this is what you are looking for:

get the contents of the file
regex out the image
echo the image

Code: Select all

$pics = file_get_contents('http://browseusers.myspace.com/Browse/Browse.aspx?z=1');
preg_match(/(<img src="http:\/\/a232.ac-images.myspacecdn.com\/[^"]" id="ctl00_cpMain_Browser_skin_ResultsView_browseList_ctl03_pnImgTag">){25}/, $matches, $pics);
print_r($matches);
you will have to set the php.ini file to treat absolute paths as files.