Tuesday, December 20, 2022

Correos Tracking

No comments:

For anyone else that needs to access Correos tracking, you can start with their API documentation (WS Canonico interface), ask your Correos rep for a user name and a password to the API (this step took several days), and then use something like the below to get the status.

$username = 'bob';
$password = 'pass';
$tracking = 'PQ43B404AA015110128001N';

$client = new GuzzleHttp\Client();
$result = $client->get(
"https://localizador.correos.es/canonico/eventos_envio_servicio_auth/$tracking?codIdioma=ES&indUltEvento=S",
['auth' => [$username, $password]]);
$body = json_decode($result->getBody());