php rest API post方法

I created post method api using php and i tested it locally by sending post request using curl and it worked fine but when i uploaded the web service on the online server and tested it using the same php curl file the output is nothing just a blank page and there is no error. here's my api code ..

<?php


$servername = "..";
$username = "..";
$password = "..";
$dbname = "..";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

$postdata = file_get_contents("php://input");
$request = json_decode($postdata);

if ($postdata!="" ){

        $campaignId= $request->id;
        $type=$request->type;

        if ($type=="Campaign"){
              $sql = "UPDATE charitycampaigns SET finalized='1' WHERE id='$campaignId'";
        }elseif($type=="IndividualCase"){
              $sql = "UPDATE campaigns SET finalized='1' WHERE id='$campaignId'";
        }else{
              echo "Wrong Charity Type!";
        }
        if ($conn->query($sql) === TRUE) {
              echo "Data updated successfully";
        }else {
              echo "Error: " . $sql . "<br>" . $conn->error;
        }

        $conn->close();
}else{
        echo "Error: No Values to post ";
}
?>

And here is my php curl code to make the post request

<?php

//API Url
$url = 'https://link of my api file ';


//Initiate cURL.
$ch = curl_init($url);

//The JSON data.
$jsonData = array(
    'id' => '25',
    'type' => 'Campaign'
);

//Encode the array into JSON.
$jsonDataEncoded = json_encode($jsonData);

//Tell cURL that we want to send a POST request.
curl_setopt($ch, CURLOPT_POST, 1);

//Attach our encoded JSON string to the POST fields.
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);

//Set the content type to application/json
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); 

//Execute the request
$result = curl_exec($ch);