I'am trying to get the read and like number of an page.
The url is: https://mp.weixin.qq.com/s/NPavBeHc8VdWXeSL6kfLRg (you must activate a mobile user agent to see read and like number. There are at the bottom left of the page. You must refresh the page.)
The problem is that read and like number are hidden when isn't a mobile user agent that visit the site.
So i tried to use file_get_contents() with a context that send user agent with http as other stackoverflow post said. But didn't work :(.
There is my code:
$url = 'https://mp.weixin.qq.com/s/NPavBeHc8VdWXeSL6kfLRg';
$opts = array('http' =>
array(
'header' => 'User-agent: Mozilla/5.0 (Linux; Android 4.4.4; HM NOTE 1LTEW Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36 MicroMessenger/6.0.0.54_r849063.501 NetType/WIFI',
)
);
$context = stream_context_create($opts);
$result = file_get_contents($url, false, $context);
print_r($result);
I also tried to modify the php.ini with
user_agent= "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Mobile Safari/537.36"