php教程|php手册
PHP,curl,json
php教程-php手册
自动发卡asp源码,vscode运行c源文件,ubuntu终端改色,tomcat起所有应用,c需要爬虫,php仿微信图片上传,新手seo教程百度推广,网站防伪查询模板,html抽奖模板免费下载lzw
本篇文章是对PHP中使用curl提交json格式数据的实现方法进行了详细的分析介绍,需要的朋友参考下
google tv remote 源码,厂商预装ubuntu成本,网络爬虫ip段,php本命,seo 工作概述lzw
柯林源码 一句话,ubuntu和arch对比,灰色多脚爬虫,display php,宁波 谷歌seolzw
复制代码 代码如下:
$data = array(“name” => “Hagrid”, “age” => “36”);
$data_string = json_encode($data);
$ch = curl_init(‘http://api.local/rest/users’);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “POST”);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
‘Content-Type: application/json’,
‘Content-Length: ‘ . strlen($data_string))
);
$result = curl_exec($ch);
,虚拟主机,香港服务器租用,网站空间