Getting META tag Attributes PHP From URL -
hi having issue when scraping meta tags url, code works on php fiddle on server return data appears different file, number of tag properties different. example 'og:url' meta tag returns tld (domain) without path passed. in browser , phpfiddle same code returns full url, including path desired. appears treating request server differently. ideas appreciated.
$dom = new domdocument(); @$dom->loadhtmlfile($url); foreach( $dom->getelementsbytagname('meta') $meta ) { echo $meta->getattribute('property'). "=>" .$meta->getattribute('content').";\n"; }
try http://php.net/manual/de/function.get-meta-tags.php may works. should work curl too, havent enough experience curl. hope you.
Comments
Post a Comment