[PHP] 纯文本查看 复制代码$post_data = array();
$post_data['version'] = "4.2.40001";
$post_data['from'] = "h5";
$post_data['systemCode'] = "63";
$post_data['platform'] = "1";
$post_data['action'] = "user.activity.bindActivityCoupons";
$post_data['activityId'] = "AO201902281646561034742";
$post_data['mobile'] = "13800138000";
$url = "https://api.hellobike.com/api?user.activity.bindActivityCoupons";
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_FAILONERROR, false);//当 HTTP 状态码大于等于 400,TRUE 将将显示错误详情。 默认情况下将返回页面,忽略 HTTP 代码。
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);//TRUE 将 curl_exec() 获取的信息以字符串返回,而不是直接输出。
if (1 == strpos("$".$url, "https://"))
{
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
}
$output = curl_exec($curl);
curl_close($curl);
return $output;