I want to scrape a myspace IMAGE url from their Friend ID I assume you use $_GET, but I don't have much knowledge in PHP.
maybe you can do that using the following code, but I guess it's against myspace TOS. This code not tested yet just direct typin here... just adjust the regular expression of no result. <?php $id="66554698"; //member id $u="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=$id"; $t = join("",file("$u")); $r = '/ctl00_Main_ctl00_UserBasicInformation1_hlDefaultImage" .*?"><img src="(.*?)"/'; $t = ereg_replace("\n", "", $t); preg_match_all($r, $t, $m); $img=$m[1][0]; echo "<img src='$img'>"; ?> Code (markup):
Thanks, it probably works, but my stupid host disables http wrapper. EDIT: it does work (tried it on a free host) Thanks a lot!
well I am not familiar with curl but here is why I found how to use it.... first it will get the data from the source url then save to file in your server.... You then open the file which is save in your server using fopen, then parse it like what the first script. <?php $ch = curl_init("http://www.example.com/"); $fp = fopen("example_homepage.txt", "w"); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp); ?> Code (markup):
do not see fwrite or fput here <?php $ch = curl_init("http://www.example.com/"); $fp = fopen("example_homepage.txt", "w"); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp); ?>