我正在使用CURL处理来自URL的数据读数。然后,我想获得每个链接的 movie_id ,并使用将接收 movie_id 的网址执行下一个过程,以便更详细地获取数据。
我的cURL代码:
<?php
$url="http://m.21cineplex.com/";
function bacaHTML($url){
$data = curl_init();
curl_setopt($data, CURLOPT_URL, $url);
curl_setopt($data, CURLOPT_HEADER, 1);
curl_setopt($data, CURLOPT_USERAGENT, "Mozilla/5.0 (BlackBerry; U; BlackBerry 9850; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0.115 Mobile Safari/534.11+");
curl_setopt($data,CURLOPT_COOKIEJAR,'cookie.txt');
curl_setopt($data,CURLOPT_COOKIEFILE,'cookie.txt');
curl_setopt($data, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($data, CURLOPT_RETURNTRANSFER, 1);
$hasil = curl_exec($data);
curl_close($data);
return $hasil;
}
$html= bacaHTML($url);
$html=str_replace(array("\r","\t","\n"),"",$html);
preg_match_all("/<ol id=\"menu_ol\">(.*?)<\/ol>/",$html,$raw);
echo "<p>Now Playing</p>".$raw[0][0]."<p>Coming Soon".$raw[0][1]."Movie News".$raw[0][2]
如何分隔 ID 以便我可以进行下一个过程?