How to modify HTTP_USER_AGENT, disguise the web browser as a mobile browser, and finally edit the post by Youritumei_habataku from 2011-11-am. in PHP, the method for judging whether the browser is a mobile browser is generally: & lt ;? Php // php determine whether the client is a mobile phone $ agent & n how to modify HTTP_USER_AGENT and disguise the web browser as a mobile browser
At the end of this post, Youritumei_habataku edited at 17:10:45 on 2011-11-10. in PHP, the following method is used to determine whether the browser is a mobile browser:
// Php determines whether the client is a mobile phone
$ Agent = $ _ SERVER ['http _ USER_AGENT '];
If (strpos ($ agent, "NetFront") | strpos ($ agent, "iPhone") | strpos ($ agent, "MIDP-2.0") | strpos ($ agent, "Opera Mini") | strpos ($ agent, "UCWEB") | strpos ($ agent, "Android") | strpos ($ agent, "Windows CE ") | strpos ($ agent, "SymbianOS "))
Header ("Location: http://bolg.malu.me/photo/wap-mini/index.php ");
?>
If it is a web browser, he will add a code so that he cannot display the page to be displayed, I would like to ask if PHP could modify its $ _ SERVER ['http _ USER_AGENT '] value and disguise itself as an iPhone or other mobile browser, in this way, I can obtain the website's mobile phone webpage content on my computer. the code is as follows:
Ob_start ();
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_URL, $ url );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
Curl_setopt ($ ch, CURLOPT_HEADER, 0 );
// Curl_setopt ($ ch, CURLOPT_POST, 1 );
// Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ param );
Thank you.
------ Solution --------------------
Use firefox to install the User Agent Switcher extension, which can simulate the ua header access sent by the mobile phone
------ Solution --------------------
Sorry, I have not carefully read the problem.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.