0
我使用捲曲發送端口的請求,而不使用此代碼使用curlto總是發送POST請求輸出
$data = array('username' => 'username', 'password' => 'password');
$url = 'http://urlhere';
$ch = curl_init($url);
$postString = http_build_query($data, '', '&');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
// or use this line curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
我用1和真正的代碼的最後一行打印結果的結果,但它總是在網頁上打印結果。如何執行curl而不輸出結果?
最後一行幫助非常感謝必須工作。 –