$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); //url地址 curl_setopt($ch, CURLOPT_POST, true); //是否post請求 curl_setopt($ch, CURLOPT_POSTFIELDS, $data); //post請求傳遞的數(shù)據(jù) curl_setopt($ch, CURLOPT_HTTPHEADER, $header);//設(shè)置header curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);//返回獲取的輸出文本流 $response = curl_exec($ch); //獲取返回的數(shù)據(jù) curl_close($ch); //關(guān)閉 |
|