~~~ <?php $host = "http://www.api51.cn"; $path = "/api/smsApi/send"; $method = "POST"; $headers = array(); //根据API的要求,定义相对应的Content-Type array_push($headers, "Content-Type".":"."application/x-www-form-urlencoded; charset=UTF-8"); $querys = ""; $bodys = "mobile=13288888888&params=1024%2C%E5%BC%A0%E4%B8%89&sign=%E7%BD%91%E6%9E%81%E7%A7%91%E6%8A%80&token=token&tpl_id=46792"; $url = $host . $path; $curl = curl_init(); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_FAILONERROR, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, true); if (1 == strpos("$".$host, "https://")) { curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); } curl_setopt($curl, CURLOPT_POSTFIELDS, $bodys); var_dump(curl_exec($curl)); ?> ~~~