Vote count:
0
I am trying to extract data from URL: http://ift.tt/1yCG9LX
<?php
include('simple_html_dom.php');
function dlPage($href) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_URL, $href);
curl_setopt($curl, CURLOPT_REFERER, $href);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.125 Safari/533.4");
$str = curl_exec($curl);
curl_close($curl);
$html= str_get_html($str);
foreach($html->find(div[id=events]) as $elm){
var_dump($elm->plaintext);exit;
// this var_dump is return empty string.
}
return $dom;
}
$url = 'http://ift.tt/1yCG9LX';
$data = dlPage($url);
print_r($data);
?>
whenever I tried to access internal article tags, I always get null or empty array. Please help me how can I access and extract the data inside the article html5 tags of match scores.
asked 41 secs ago
How to target an inner article tag using PHP Simple HTML DOM Parser?
Aucun commentaire:
Enregistrer un commentaire