卷曲不工作,没有显示任何输出

时间:2014-02-14 08:00:29

标签: php curl

<?php
$url = "https://www.example.com";   
$data = array(
    "email" => "vicky@gg.com",
    "firstname" => "firstname",
    "lastname" => "lastname",
    "password1" => "123456",
    "password2" => "123456",
    "key" => "d12121c70dda5edfgd1df6633fdb3"
);                                                                    

$data_string = json_encode($data);   

$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($ch);
$output = json_decode($result,true);
curl_close($ch);
echo $output;
?>

1 个答案:

答案 0 :(得分:0)

使用

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

禁用SSL检查。