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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -