I want change this format become using curl
in PHP from this format
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://trythis.co.id/api/android/iki_bank/fcm",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array('memberid' => '58108982293','title' => 'samu'),
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
"Authorization: asdasIjoxNadNZ6JI"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
to this format
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "example.com");
$array = array("key1" => "value1", "key2" => "value2");
$data= http_build_query($array);
$url = "your url";
$headers = array(
'Content-type: application/xml',
'Authorization: gfhjui',
);
// Initialize a CURL session.
$ch = curl_init($url);
// setting the headers
curl_setopt($curlHandle, CURLOPT_HTTPHEADER, $headers);
//To Post the content
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// Return Page contents.
curl_setopt( $ch , CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
if (!$response) {
echo curl_error($ch);
}else{
echo $result;
}
I hope this helps pls dont forget to mark the answer as correct if it helps you:
$url = "WRITE HERE YOUR URL";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 4);
$response = curl_exec($ch);
if (!$response) {
echo curl_error($ch);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.