Grabbing Info From Site's HTML DOM Parser

Hi can someone help me out as i’m new to php.

I have a grabber built in to my script that gets info from other sites for example.

This part is from the site that my grabber gets the info from.

[code]


Runtime:


103 min
[/code]

And this is how my grabber gets this info from the site.

$times = $dom->getElementsByTagName('time'); for($i=0; $i<$times->length; $i++){ $itemprop = $times->item($i)->getAttribute("itemprop"); if ($itemprop == "duration"){ if ($times->item($i)->textContent!='-'){ $res['duration'] = $times->item($i)->textContent; } } }

Now what i’m stuck on is what would the code be to get the date published from the site.

[code]
16 November 1990

(USA) [/code]

Could someone please help as i don’t have a clue about writing php.

Sounds like this “question” would be better suited on a “coder for hire” site

Just taking a guess here, I didn’t test this or anything, just manipulated the code you provided.

[php] $times = $dom->getElementsByTagName(‘meta’);
for($i=0; $i<$times->length; $i++){
$itemprop = $times->item($i)->getAttribute(“itemprop”);
if ($itemprop == “datePublished”){
$res[‘duration’] = $times->item($i)->getAttribute(“content”);
}
}
}[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service