supratwinturbo Posted January 5, 2007 Share Posted January 5, 2007 Hi all, Can someone please point me in the right direction? I have been trying to figure out how people can grab the layout from a myspace page by using the friendid. I think they simply parse the myspace page for anything between <style> ... </style> and then send the code to a form. For example, this is one site that offers the feature:http://pimpyours.com/myspace_theme_stealer/index.phpHere is an example friendid 31323350Anyone have any ideas? Has someone written something similar? Your help is much appreciated. Thank you,SupraTT Link to comment https://forums.phpfreaks.com/topic/32941-how-do-i-write-script-to-parse-a-myspace-webpage/ Share on other sites More sharing options...
matto Posted January 5, 2007 Share Posted January 5, 2007 This could be done using the file_get_contents() function and the use of regular expressions ;) Link to comment https://forums.phpfreaks.com/topic/32941-how-do-i-write-script-to-parse-a-myspace-webpage/#findComment-153402 Share on other sites More sharing options...
rygonet Posted May 12, 2007 Share Posted May 12, 2007 Can be done with Curl..http://www.php.net/curlNot to hard.. use some regular expressions to set the user-set inputs as vars (or in an array). Link to comment https://forums.phpfreaks.com/topic/32941-how-do-i-write-script-to-parse-a-myspace-webpage/#findComment-251070 Share on other sites More sharing options...
chigley Posted May 12, 2007 Share Posted May 12, 2007 [code]<?phpfunction textbetweenarray($s1,$s2,$s){ $myarray=array(); $s1=strtolower($s1); $s2=strtolower($s2); $L1=strlen($s1); $L2=strlen($s2); $scheck=strtolower($s); do{ $pos1 = strpos($scheck,$s1); if($pos1!==false){ $pos2 = strpos(substr($scheck,$pos1+$L1),$s2); if($pos2!==false){ $myarray[]=substr($s,$pos1+$L1,$pos2); $s=substr($s,$pos1+$L1+$pos2+$L2); $scheck=strtolower($s); } } } while (($pos1!==false)and($pos2!==false));return $myarray;}$friendid = $_GET['id'];$url = "http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=$friendid";$file = file_get_contents($url);$style = textbetweenarray("<style type=\"text/css\">", "</style>", $file);echo "<pre>";foreach($style as $css) { echo "$css\n\n";}echo "</pre>";?>[/code]Not tested, should work fine leaving you with an array of each occurrence of text between <style type="text/css"> and </style>. Can be adapted to suit your needs easily.Chigley :) Link to comment https://forums.phpfreaks.com/topic/32941-how-do-i-write-script-to-parse-a-myspace-webpage/#findComment-251180 Share on other sites More sharing options...
Logix Posted August 30, 2007 Share Posted August 30, 2007 Thanks for code - this will actually put me in the right direction... ;D Link to comment https://forums.phpfreaks.com/topic/32941-how-do-i-write-script-to-parse-a-myspace-webpage/#findComment-337713 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.