“Periksa apakah permintaan curl berhasil PHP” Kode Jawaban

status cetak php curl

$url = 'http://www.example.com';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, true);    // we want headers
curl_setopt($ch, CURLOPT_NOBODY, true);    // we don't need body
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT,10);
$output = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo 'HTTP code: ' . $httpcode;
Shiny Stork

Tes Curl PHP

function _isCurl(){
    return function_exists('curl_version');
}
Nipun

Periksa apakah permintaan curl berhasil PHP

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://uat.sindabad.com/rest/V1/mpapi/sellers/create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\n   \"customer\":{\n      \"email\":\"[email protected]\",\n      \"firstname\":\"aa\",\n      \"lastname\":\"aa\",\n      \"storeId\":1,\n      \"websiteId\":1\n   },\n   \"supplier_portal_id\":1,\n   \"is_seller\":1,\n   \"profileurl\":\"sas1111astesta\",\n   \"password\":\"itstest17\",\n   \"registered\":\"0\"\n  \n}");

$headers = array();
$headers[] = 'Content-Type: application/json';
$headers[] = 'Authorization: prevg60sup0y1mb6o4vtvfrp82brnlgt';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close($ch);
Wandering Whale

Jawaban yang mirip dengan “Periksa apakah permintaan curl berhasil PHP”

Pertanyaan yang mirip dengan “Periksa apakah permintaan curl berhasil PHP”

Lebih banyak jawaban terkait untuk “Periksa apakah permintaan curl berhasil PHP” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya