Se non vuoi morire male appresso alle chiamate GET e POST da farsi in php (programmatically come dicono in Scozia), prova a usare quanto segue.

E’ una funzione php per eseguire chiamate cURL in GET e POST passando un numero umano di parametri e collezionato dopo tanti calendari tirati giù e mezzo stackoverlow:

function my_http_request($url, $method, $postdata = null, $headers = null)
{
	$userAgentHeaders = array(
			"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36",
			"Accept-Language:en-US,en;q=0.5"
		);
	if ('GET' == $method)
	{
		if (null != $headers)
		{
			$userAgentHeaders = array_merge($userAgentHeaders, $headers);
		}
		$cURLConnection = curl_init();
		curl_setopt_array($cURLConnection, array(
		    CURLOPT_URL => $url,
		    #CURLOPT_PORT => "443",
		    CURLOPT_RETURNTRANSFER => true,
				CURLOPT_FAILONERROR => true,
		    CURLOPT_ENCODING => "",
		    CURLOPT_MAXREDIRS => 10,
		    CURLOPT_SSL_VERIFYPEER => false,
		    CURLOPT_SSL_VERIFYHOST => false,
				CURLOPT_CONNECTTIMEOUT => 0,
				CURLOPT_CONNECTTIMEOUT => 400,
				CURLOPT_ENCODING => 'gzip',
		    CURLOPT_HTTPHEADER => $userAgentHeaders
		));

		$response = curl_exec($cURLConnection);
		if (curl_errno($cURLConnection)) {
		    $error_msg = curl_error($cURLConnection);
				curl_close($cURLConnection);
				return array("success" => "KO", "details" => $error_msg);
		}
		curl_close($cURLConnection);
		return array("success" => "OK", "details" => $response);
	}
	else if ('POST' == $method)
	{
		if (null != $headers)
		{
			$userAgentHeaders = array_merge($userAgentHeaders, $headers);
		}
		$cURLConnection = curl_init($url);
		curl_setopt_array($cURLConnection, array(
		    CURLOPT_URL => $url,
		    #CURLOPT_PORT => "443",
		    CURLOPT_RETURNTRANSFER => true,
				CURLOPT_FAILONERROR => true,
		    CURLOPT_ENCODING => "",
		    CURLOPT_MAXREDIRS => 10,
		    CURLOPT_SSL_VERIFYPEER => false,
		    CURLOPT_SSL_VERIFYHOST => false,
				CURLOPT_CONNECTTIMEOUT => 0,
				CURLOPT_CONNECTTIMEOUT => 400,
				CURLOPT_ENCODING => 'gzip',
		    CURLOPT_HTTPHEADER => $userAgentHeaders,

				CURLOPT_POST => 1,
    		CURLOPT_POSTFIELDS => $postdata,
		));

		$apiResponse = curl_exec($cURLConnection);
		if (curl_errno($cURLConnection)) {
		    $error_msg = curl_error($cURLConnection);
				curl_close($cURLConnection);
				return array("success" => "KO", "details" => $error_msg);
		}
		curl_close($cURLConnection);
		return array("success" => "OK", "details" => $response);
	}
}