$PostData = "a=abc&b=def";
$curl = curl_init("https://test.com/test.php?$PostData");
//檢查 curl 有無作用
if (! $curl) {
die( "Cannot allocate a new PHP-CURL handle" );
}
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1); //SSL
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);//SSL
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
//這個若是沒設 , curl_exec($curl) 會直接印出來
curl_setopt ($curl, CURLOPT_HEADER, 0); // 得到回傳的HTTP頁面.
$data = curl_exec($curl);
echo "&data=$data"; //輸出傳回值
curl_close($curl);
沒有留言:
張貼留言