使用curl
curl是制作http请求的强大工具,允许您以编程方式与网页交互。一项常见的任务是传递帖子数据,该数据用于将数据提交给表单。这是用卷曲来完成此操作的方法:解决方案: ='@/home/user/user/world.jpg'; $ handle = curl_init($ url); curl_setopt($ handle,curlopt_post,true); curl_setopt($ handle,curlopt_postfields,$ data); curl_exec($ handle); curl_close($ handle);
说明:curl提供两个用于编码帖子数据的选项:
数据作为乘数/form-data作为supper/form-data,可能总是被服务器接受。应用程序/x-www-form-urlenCoded,如html表单提交中使用的。用于编码为字符串,请使用http_build_query($ data)作为值curlopt_postfields。
(https://wwwww.php.net/manual/en/fu nction.curl-init.php)[curl_setopt](https://www.php.net/manual/manual/en/en/en/function.curl-setopt.php)
免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。
Copyright© 2022 湘ICP备2022001581号-3