Using POST Method 


function postapimethod($mobile,$fullname,$email)

{

    

    $userName='username';

    $password='passwoard';

   

    $curl = curl_init();


    curl_setopt_array($curl, array(

        CURLOPT_URL => 'Link_over_which_you_want_to_send_data',

        CURLOPT_RETURNTRANSFER => true,

        CURLOPT_ENCODING => '',

        CURLOPT_MAXREDIRS => 10,

        CURLOPT_TIMEOUT => 0,

        CURLOPT_FOLLOWLOCATION => true,

        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

        CURLOPT_CUSTOMREQUEST => 'POST',

        CURLOPT_POSTFIELDS => '{

            "FullName": "'.$fullname.'",

             "MobileNumber": "'.$mobile.'",

            "EmailID": "'.$email.'",

           

           

    }',

        CURLOPT_HTTPHEADER => array(

            'Content-Type: application/json',

            'Authorization: Basic ' . base64_encode($userName . ':' . $password)

        ),

    ));

 $response = curl_exec($curl);

curl_close($curl);

 return $response;

}       


after writing this function you can simply call this function linke 


$senddata= postapimethod($mobile,$fullname,$email);



GET Method


function getapimethod($name,$contact,$email){

   

    $url= 'Link_over_which_you_want_to_send_data?';


$data = array(

              'name' => $name,

              'contact' => $contact,

              'email' => $email,

             );


$msg = http_build_query($data);


$url .= $msg;

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

$result = curl_exec($ch);

curl_close($ch);

if (curl_errno($ch)) {

    echo 'Error: ' . curl_error($ch);

}

$http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);

curl_close($ch);

return $result;

}

after writing this function you can simply call this function link


$senddata= getapimethod($name,$contact,$email);