Ejemplo n.º 1
0
<html>
<body>
<?php 
// Require the main ups class and upsRate
require '../autoload.php';
// Get credentials from a form
$accessNumber = $_POST['accessNumber'];
$username = $_POST['username'];
$password = $_POST['password'];
// If the form is filled out go get a rate from UPS
if ($accessNumber) {
    /**
     * Initialize Connector
     * @var [type]
     */
    $upsConnect = new \UPS\Connector($accessNumber, $username, $password);
    $upsConnect->setTestingMode(true);
    /**
     * Initialize Request Class
     * @var [type]
     */
    $upsValidateStreet = new \UPS\ValidateStreet($upsConnect);
    /**
     * Process Request
     * @var [type]
     */
    $res = $upsValidateStreet->validateAddress(array('ConsigneeName' => '', 'BuildingName' => '', 'AddressLine1' => 'AIR ROAD SUITE 7', 'AddressLine2' => '', 'AddressLine3' => '', 'PoliticalDivision2' => 'SAN DIEGO', 'PoliticalDivision1' => 'CA', 'PostcodePrimaryLow' => '92154', 'CountryCode' => 'US'));
}
?>

<form action="" method="POST">
Ejemplo n.º 2
0
<html>
<body>
<?php 
// // Require the main ups class and upsRate
require '../autoload.php';
// Get credentials from a form
$accessNumber = $_POST['accessNumber'];
$username = $_POST['username'];
$password = $_POST['password'];
$ShipmentIdentificationNumber = $_POST['ShipmentIdentificationNumber'];
// If the form is filled out go get a rate from UPS
if ($accessNumber != '' && $username != '' && $password != '') {
    //Initiate the main UPS class
    $upsConnect = new \UPS\Connector("{$accessNumber}", "{$username}", "{$password}");
    $upsConnect->setTemplatePath('../../xml/');
    $upsConnect->setTestingMode(1);
    // Change this to 0 for production
    $upsVoid = new upsVoid($upsConnect);
    $upsVoid->buildRequestXML($ShipmentIdentificationNumber);
    echo $upsVoid->responseXML;
}
?>

<h2>XML Sent to UPS</h2>
<pre><?php 
echo htmlspecialchars($upsVoid->xmlSent);
?>
</pre>

<form action="" method="POST">
	Access Key: <input type="text" name="accessNumber" value="<?php