gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-10-31 23:10:47 24 4
gpt4 key购买 nike

我正在编写一个基于网络的 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com