//Post方式实现
$url = "http://localhost/web_services.php";
$post_data = array ("username" => "bob","key" => "12345");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// post数据
curl_setopt($ch, CURLOPT_POST, 1);
// post的变量
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);
相关文章
- git提交代码时报错:RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
- THINKPHP导入全部post参数
- Vue post提交
- Node.js基础学习二之POST请求
- 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"
- 利用WebClient 模拟Form Post请求上传文件
- 渗透测试——万能密码与POST注入
- linux运维笔记——curl
- Git POST git-upload-pack (960 bytes) remote: Enumerating objects: 1705, done.
- curl静态库的编译与使用