You can't do it through USPS. They use SOAP/XML for their endpoints with absolutely no client libraries or documentation to support you, but you can use Easypost to connect to USPS today using PHP.
<?php $client = new \EasyPost\EasyPostClient(getenv('EASYPOST_API_KEY')); $shipment = $client->shipment->create([ 'to_address' => $to_address, 'from_address' => $from_address, 'parcel' => [ 'predefined_package' => 'Parcel', 'weight' => 28 ] ]); $client->shipment->buy( $shipment->id, ['rate' => $shipment->lowest_rate()] );
QALO uses EasyPost's API to automate their returns for an unbeatable customer experience.
With EasyPost's API, Expedited Passports & Visas cut their operational load in half.