I want to create check for url extensions. for example if http://link/kk.mp3 { save on file } if http://link/html, php and other links { open link and start finding .mp3 }
<? $file = "http://..../index.html"; $exp = explode(".", $file); $extension = strtolower(end($exp)); if($extension == "html") { } ... ?> PHP:
<?php $original_file = file_get_contents ("http://papa.pk/indian/s12/Rakhtbeej/Songs.html"); $stripped_file = strip_tags($original_file, "<a>"); preg_match_all("/<a(?:[^>]*)href=\"([^\"]*)\"(?:[^>]*)>(?:[^<]*)<\/a>/is", $stripped_file, $matches); header("Content-type: text/plain"); //Set the content type to plain text so the print below is easy to read! $str=print_r($matches); //View the array to see if it worked ?> run this script and see i want to crawl all link instead of .mp3 .mp3 links save on txt
<?php $original_file = file_get_contents ("http://papa.pk/indian/s12/Rakhtbeej/Songs.html"); $stripped_file = strip_tags($original_file, "<a>"); preg_match_all("/<a(?:[^>]*)href=\"([^\"]*mp3)\"(?:[^>]*)>(?:[^<]*)<\/a>/is", $stripped_file, $matches); header("Content-type: text/plain"); //Set the type to plain text so the print below is easy to read! $str=print_r($matches); //View the array to see if it worked ?> PHP:
it's just finding .mp3 i need .mp3 but other links for depth crawl for example if http:// link.html have 2 .mp3 links and 3 .html crawl save mp3 link on txt and start crawling .html and other follow links