Skip to content

Instantly share code, notes, and snippets.

@pedroresende
Last active May 15, 2019 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedroresende/5318f32eece64b56c11539e1cd216eb3 to your computer and use it in GitHub Desktop.
Save pedroresende/5318f32eece64b56c11539e1cd216eb3 to your computer and use it in GitHub Desktop.
<?php
$time_start = microtime(true);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://api.fix_trailing_old_variables.kinternal.kwankodev.net/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n\t\"jsonrpc\": \"2.0\",\n\t\"id\": 1,\n\t\"method\": \"Vitrine:isVATValid\",\n\t\"params\": {\n\t\t\"vat_number\": \"PT504499777\",\n\t\t\"country_code\": \"PT\"\n\t}\n}",
CURLOPT_HTTPHEADER => array(
"authorization: Basic dml0cmluZTp0ZXN0cGFzc3dvcmQ=",
"cache-control: no-cache",
"content-type: application/json",
"x-ld-debug: 1"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
$time_end = microtime(true);
$execution_time = ($time_end - $time_start);
//execution time of the script
echo '<b>Total Execution Time:</b> '.$execution_time.' Segs';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment