Home > Backend Development > PHP Tutorial > ios - PHP如何模拟安卓设备,请求API接口的数据

ios - PHP如何模拟安卓设备,请求API接口的数据

WBOY
Release: 2016-06-06 20:41:32
Original
1327 people have browsed it

抓包获取的安卓设备请求API时候携带了这么一大堆数据,PHP如何模拟这些数据?
customerId: 801
clientAgent: M351#1080*1800
versionId: 5.6.2
model: Generic/AnyPhone
contentformat: json2
userId: 412B46585B10A8B8A8AAC6E7F92B8811
Token: 7531756a785967676c4a6371664b33767531452b356b506e
agency: MeizuStore01
clientTest: false
Content-Length: 609
Content-Type: application/x-www-form-urlencoded
Host: mobds.ganji.cn
Connection: Keep-Alive
User-Agent: Paros/3.2.13

回复内容:

抓包获取的安卓设备请求API时候携带了这么一大堆数据,PHP如何模拟这些数据?
customerId: 801
clientAgent: M351#1080*1800
versionId: 5.6.2
model: Generic/AnyPhone
contentformat: json2
userId: 412B46585B10A8B8A8AAC6E7F92B8811
Token: 7531756a785967676c4a6371664b33767531452b356b506e
agency: MeizuStore01
clientTest: false
Content-Length: 609
Content-Type: application/x-www-form-urlencoded
Host: mobds.ganji.cn
Connection: Keep-Alive
User-Agent: Paros/3.2.13

模拟的时候,在头信息中携带这些参数。

今天正好看到一个php httpclient,感觉比较好用,推荐下。
http://unirest.io/php.html

用curl设置ua,把post头部弄一样

方法多得是,看你的POST请求还是GET请求,CURL扩展可以实现!!!

可以用postman这个chrome插件,调试API接口很方便。

postman 可以添加多种类型的信息 包含这些头信息

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template