Home  >  Article  >  Backend Development  >  脑袋信息 User-Agent

脑袋信息 User-Agent

WBOY
WBOYOriginal
2016-06-13 12:11:15945browse

头部信息 User-Agent
'header'=>'Content-type: application/x-www-form-urlencoded'."". 'User-Agent : post test'."".'Content-length: '.strlen($post_string)+8, 

请解释一下,上面这句话的意思
我知道的是 表单提交的时候加密  内容长度不低于8字节
------解决思路----------------------
1.application/x-www-form-urlencoded就是一种表达提交的方式,该方式是采用urlencode的,也就是说,提交的数据都是经过加密的,服务器端需要decode才能正确获得数据。
2.User-Agent:用户代理是指浏览器,它的信息包括硬件平台、系统软件、应用软件和用户个人偏好
3.content-length:内容长度,strlen($post_string)+8,表示post的字符串长度+8,即最小也有8。
------解决思路----------------------
Content-type  编码方式  在这里是 application/x-www-form-urlencoded  提交的数据被编码为名称/值对
Content-length 数传输数据的大小  就是post数据的长度
如果是post请求  就必须要指定Content-type 和 Content-length 

User-Agent 是用户代理  就是浏览器  如我的是chrome  用户代理“Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36”  你在这里是乱填的   



strlen($post_string) 即可 不知+8干啥

Statement:
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