Note that there are some explanatory texts on larger screens.

plurals
  1. POMeta description being returned in wrong language using php
    primarykey
    data
    text
    <p>I wonder if someone could shed some light on a issue i am experiencing. I am building an SEO tool that looks at a websites title and description meta tag. What I have experienced is that using </p> <pre><code>&lt;?php $tags = get_meta_tags("https://twitter.com"); echo $tags['description']; ?&gt; </code></pre> <p>I am getting the description returned in German </p> <blockquote> <p><em>"Verbinde Dich sofort mit den Dingen, die für Dich am wichtigsten sind. Folge Freunden, Experten, Lieblingsstars und aktuellen Nachrichten"</em></p> </blockquote> <p>and not in English</p> <blockquote> <p><em>"Instantly connect to what's most important to you. Follow your friends, experts, favorite celebrities, and breaking news."</em></p> </blockquote> <p>I also discovered that Bing.com I also have this issue with too. I tried this with Curl too and got the same result.</p> <p>This is what my curl code looked like,</p> <pre><code>&lt;? $header[] = "Cache-Control: max-age=0"; $header[] = "Connection: keep-alive"; $header[] = "Keep-Alive: 300"; $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7"; $header[] = "Accept-Language: en-us,en;q=0.5"; $header[] = "Pragma: "; // browsers keep this blank. function file_get_contents_curl($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); $data = curl_exec($ch); curl_close($ch); return $data; } $html = file_get_contents_curl("https://twitter.com"); //parsing begins here: $doc = new DOMDocument(); @$doc-&gt;loadHTML($html); $nodes = $doc-&gt;getElementsByTagName('title'); //get and display what you need: $title = $nodes-&gt;item(0)-&gt;nodeValue; $metas = $doc-&gt;getElementsByTagName('meta'); for ($i = 0; $i &lt; $metas-&gt;length; $i++) { $meta = $metas-&gt;item($i); if($meta-&gt;getAttribute('name') == 'description') $description = $meta-&gt;getAttribute('content'); if($meta-&gt;getAttribute('name') == 'keywords') $keywords = $meta-&gt;getAttribute('content'); if($meta-&gt;getAttribute('language') == 'language'); $language = $meta-&gt;getAttribute('language'); } echo "Title: $title". '&lt;br/&gt;&lt;br/&gt;'; echo "Description: $description". '&lt;br/&gt;&lt;br/&gt;'; echo "Keywords: $keywords"; ?&gt; </code></pre> <p>The curl response is running here => <a href="http://www.chillwebdesigns.co.uk/tools/4/test.php" rel="nofollow">http://www.chillwebdesigns.co.uk/tools/4/test.php</a></p> <p>Anyone ever come across this before?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload