Searching and Regx in PHP

stevefox

New Member
As I am new in PHP.Here is my js code\[code\] var sites = [ //Texte anime {url:" http://carouselinfo.com/canal/", duration:9}, //Texte anime {url:" http://carouselinfo.com/canal-2/", duration:9}, //Intro detallee {url:"http://carouselinfo.com/index-t1.html", duration:35}, //CTA {url:"http://carouselinfo.com/index-t2.html", duration:35}, //Football {url:"http://carouselinfo.com/twitter-ligue/", duration:100}, //Texte anime {url:" http://carouselinfo.com/canal-2/", duration:9}, //TrailersClub.com {url:"http://trailersclub.com/?lang=fr", duration:480}, //Heure {url:"http://carouselinfo.com/heure", duration:8}, //Meteo {url:"http://carouselinfo.com/meteo", duration:12}, //Texte anime {url:" http://carouselinfo.com/canal-cine/", duration:9}, //Cine {url:"http://carouselinfo.com/cine/index-t1.html", duration:150}, //Texte anime {url:" http://carouselinfo.com/canal-2/", duration:9}, //Heure {url:"http://carouselinfo.com/heure", duration:8}, //Meteo {url:"http://carouselinfo.com/meteo", duration:12}, //Texte anime {url:" http://carouselinfo.com/canal-cine/", duration:9}, //Cine ];\[/code\]I want to perform some search task like url and duration so as to display in seperate coloumn but when I perform Regx for http then nothing print on html.Here is my rough PHP code:\[code\]$ch = curl_init();curl_setopt($ch, CURLOPT_URL,'http://carouselinfo.com/contents.js');curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $contents = curl_exec ($ch); $contents = json_encode($contents,true); curl_close($ch); echo $contents; $reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/"; if (preg_match_all($reg_exUrl,$contents,$url)){ echo '<br/>'; echo $url;}\[/code\]
 
Back
Top