You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some sites serve content differently, or not at all *cough*Facebook*, depending
on the user_agent string passed in the headers. As the function is now, the
user would have to hard-code these extra parameters in. If you change the
file_get_dom function to the following:
function file_get_dom($file, $return_root = true, $use_include_path = false,
$context = null) {
$f = file_get_contents($file, $use_include_path, $context);
return (($f === false) ? false : str_get_dom($f, $return_root));
}
You could set this on a case-by-case basis like so:
$opts = array('http' => array('method' => 'GET', 'header' => "Accept-language:
en\r\n", 'user_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US;
rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16'));
$context = stream_context_create($opts);
$tmp_discussion_html = file_get_html($some_url, true, false, $context);
Original issue reported on code.google.com by thevelem...@gmail.com on 29 Apr 2011 at 10:45
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
thevelem...@gmail.com
on 29 Apr 2011 at 10:45The text was updated successfully, but these errors were encountered: