Jump to content

DJHandsfree

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

DJHandsfree's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for your input guys, I have got it doing the job but there's one more thing I need to get accomplished and il be happy! Here's the code below so far <?php /* Test URL http://djhandsfree.co.uk/sclinks.php */ /* Text to match <h3><a href="/dj-handsfree/recording-from-www-flexfm-co">Recording from www.flexfm.co.uk / 99.7FM - Wednesday 10pm-12am 04/01/12</a></h3> */ //Sound Cloud Page $data = file_get_contents('http://soundcloud.com/dj-handsfree/'); //Match required text preg_match_all('/<h3><a href="\/dj-handsfree\/(.*)">.*<\/a><\/h3>/', $data, $matches); $content = $matches[1]; //Output $total = count($content); for($i=0; $i<$total; $i++) { echo '<b>'.$content[$i].'</b><br /><object height="81" width="550"><param name="movie" value="http://soundcloud.com/dj-handsfree/'.$content[$i].'"></param><param name="allowscriptaccess" value="always"></param><embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/player.swf?url=http://soundcloud.com/dj-handsfree/'.$content[$i].'" type="application/x-shockwave-flash" width="550"></embed></object><p><br />'; } ?> If you see the demo url http://djhandsfree.co.uk/sclinks.php you can see I have used the same matched text as the title of each track but it's not really perfect as the actual title should be reflected by the part underlined <h3><a href="/dj-handsfree/recording-from-www-flexfm-co">Recording from www.flexfm.co.uk / 99.7FM - Wednesday 10pm-12am 04/01/12</a></h3> If anyone could suggest any ideas of where to take it next be great!
  2. Hi, I have spend a few day's trying to get my head around how to make this code work as I'm still quite new to PHP The code below so far matches all text from a webpage within the <h3></h3> tags as within them is a url I need. Then that URL within all those h3 tags I only need the text after the last slash of the link so I can put into a flash object and load the requested value. As shown below heres what I have: <html> <head> <title>Find SC Links</title> </head> <body> <?php /* Have a look at the url below within the tags I only need the last part of the url after the / from all the text string <h3><a href="/anyfolder/recording-1-week">link1</a></h3> so just need recording-1-week <h3><a href="/anyfolder/recording-2-week">link2</a></h3> so just need recording-2-week <h3><a href="/anyfolder/recording-3-week">link3</a></h3> so just need recording-3-week then echo them out within this below echo '<div class="bbvideo"><object height="81" width="550"><param name="movie" value="'.$text_string_after_last_slash.'"></param><param name="allowscriptaccess" value="always"></param><embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/player.swf?url='.$text_string_after_last_slash.'" type="application/x-shockwave-flash" width="550"></embed></object></div><p>'; */ $data = file_get_contents('http://soundcloud.com/dj-handsfree/'); preg_match_all ("/<h3>([^`]*?)<\/h3>/", $data, $matches); $content = $matches[1]; //echo $content; $total = count($content); for($i=0; $i<$total; $i++) { echo $content[$i]."<br />"; } ?> </body> </html> Any help on pointing me in the right direction on this one be much help spend to much of my little time on this one..
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.