发票查验接口PHP集成:
<?php
class Sample {
public function run() {
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://XXX/verapi/v2/verInvoice.do',
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 => array('key' => 'M***********g','secret' => '3***********6','typeId' => '3007','invoiceCode' => '*******','invoiceNumber' => '**********','billingDate' => '********','totalAmount' => '*************','checkCode' => '*********','salesTaxNo' => '*********','orderNo' => '*********','isNew' => 'true'),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
}
}
$rtn = (new Sample())->run();
print_r($rtn);