私はPHPを初めて使用するので、これが私のjsコードです。
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
];
個別の列に表示するために、URLや期間などの検索タスクを実行したいのですが、httpに対してRegxを実行すると、htmlに何も出力されません。
これが私の大まかなPHPコードです:
$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;
}