Im using PHP to load a website in a DOM Tree. Is there a way to modify the user agent that is sent using DOMDocument::loadHTMLFile()?
function parseThis($url)
{
$html = new DOMDocument();
$html->loadHtmlFile( $url );
return $html
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Change the
user_agentvalue inphp.ini, which should be sent in anything making use of the http stream wrapper likeDOMDocument::loadHtmlFile(), file_get_contents(), etc.The same can also be accomplished in an Apache
.htaccessby settingphp_value user_agentif permitted by your server configuration.