Creating a proxy to spoof iPhone user-agent in PHP?

后端 未结 3 1383
别跟我提以往
别跟我提以往 2020-12-17 04:52

I\'m writing a web based iPhone simulator and I\'m looking for a way to spoof iPhone\'s Safari browser so that web pages loaded within the simulator (iframe) to use the mobi

3条回答
  •  粉色の甜心
    2020-12-17 05:39

    You could use a PHP class, such as Ben Alman's Simple PHP Proxy / Github.

    It let's you redirect cross-domain URL's in a variety of ways, including the following method to "change up" your User Agent....

    user_agent - This value will be sent to the remote URL request as the
         `User-Agent:` HTTP request header. If omitted, the browser user agent
         will be passed through.
    

    I use it to insert an iFrame - with the iPhone version of google voice - into any page, for example...

    Some of the many other ways you can alter the request by using this script are...

       url - The remote URL resource to fetch. Any GET parameters to be passed
         through to the remote URL resource must be urlencoded in this parameter.
       mode - If mode=native, the response will be sent using the same content
         type and headers that the remote URL resource returned. If omitted, the
         response will be JSON (or JSONP).  and 
         are disabled by default, see  for more information.
       callback - If specified, the response JSON will be wrapped in this named
         function call. This parameter and  are disabled by
         default, see  for more information.
       send_cookies - If send_cookies=1, all cookies will be forwarded through to
         the remote URL request.
       send_session - If send_session=1 and send_cookies=1, the SID cookie will be
         forwarded through to the remote URL request.
       full_headers - If a JSON request and full_headers=1, the JSON response will
         contain detailed header information.
       full_status - If a JSON request and full_status=1, the JSON response will
         contain detailed cURL status information, otherwise it will just contain
         the `http_code` property.
    

提交回复
热议问题