php - 在 PHP 中创建一个代理来欺骗 iPhone 用户代理?

标签 php iphone proxy user-agent

我正在编写一个基于网络的 iPhone 模拟器,我正在寻找一种方法来欺骗 iPhone 的 Safari 浏览器,以便在模拟器 (iframe) 中加载的网页使用移动版本。根据我的理解,我需要修改用户代理。

我如何着手创建一个 PHP 代理脚本来欺骗 iPhone 的用户代理?

最佳答案

您可以使用 PHP 类,例如 Ben Alman's Simple PHP Proxy/Github .

它让您以多种方式重定向跨域 URL,包括以下“更改”您的用户代理的方法....

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.

我用它来插入 iFrame - 带有 iPhone 版本的谷歌语音 - 到任何页面,例如......

您可以使用此脚本更改请求的许多其他方法中的一些是...

   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). <Native requests> and <JSONP requests>
     are disabled by default, see <Configuration Options> for more information.
   callback - If specified, the response JSON will be wrapped in this named
     function call. This parameter and <JSONP requests> are disabled by
     default, see <Configuration Options> 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.

关于php - 在 PHP 中创建一个代理来欺骗 iPhone 用户代理?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5426899/

相关文章:

php - 如何使用 PHP 脚本添加 javascript 警报?

php - 如何在 PHP 中使用 OR 条件正确的 MySqli SELECT?

iphone - 如果被包装的文本中有一个长字符串,则 sizeWithFont 不会为 UITextView 提供正确的高度

iphone - self.tabBarItem.title 不起作用?

proxy - paramiko:SSH 端口转发以获取 SQL 转储

javascript - Wp_admin ajax 请求返回响应 "0"

php - Laravel Ardent 多对多关系抛出错误

iphone - 音频文件无法在 iPhone 5 中播放

proxy - 带 Spring 的 CGLIB 抛出 IllegalAccessError

node.js - 通过代理使用node-XMLHttpRequest?