I have never worked with xml and this is my first time working with an api so this is all very new to me. Essentially, I am trying to place my testing information into the FedEx api so it can print out a shipping label. I have no idea on how to save this result into a variable and put it on a clickable link where the user can click on it and it will display a pdf image for them so they can print out this shipping label.
This is my code here:
$path_to_wsdl = $_SERVER['DOCUMENT_ROOT'] . "/dashboard/website/ShipService_v23.wsdl";
$client = new SoapClient($path_to_wsdl, array('trace' => 1));
$request['WebAuthenticationDetail'] = array(
'ParentCredential' => array (
'Key' => 'XXXX',
'Password' => 'XXXX'
),
'UserCredential' => array(
'Key' => 'XXXX',
'Password' => 'XXXX'
)
);
$request['ClientDetail'] = array(
'AccountNumber' => 'XXXX',
'MeterNumber' => 'XXXX'
);
$request['Version'] = array(
'ServiceId' => 'ship',
'Major' => '23',
'Intermediate' => '0',
'Minor' => '0'
);
$request['RequestedShipment'] = array(
'ShipTimestamp' => '2017-12-14T12:34:56-06:00',
'DropoffType' => 'REGULAR_PICKUP',
'ServiceType' => 'STANDARD_OVERNIGHT',
'PackagingType' => 'FEDEX_BOX',
'Shipper' => array(
'AccountNumber' => 'XXXX',
'Contact' => array(
'PersonName' => 'Bob Jones',
'CompanyName' => 'New Company',
'PhoneNumber' => '555-555-5555',
'EMailAddress' => 'example@example.com'
),
'Address' => array(
'StreetLines' => '1202 Chalet Ln',
'City' => 'Harrison',
'StateOrProvinceCode' => 'AR',
'PostalCode' => '72601',
'CountryCode' => 'US'
)
),
'Recipient' => array(
'AccountNumber' => 'XXXX',
'Contact' => array(
'PersonName' => 'My Name',
'CompanyName' => 'Another Company',
'PhoneNumber' => '555-555-5555',
'EMailAddress' => 'another@example.com'
),
'Address' => array(
'StreetLines' => '123 Test St',
'City' => 'Test City',
'StateOrProvinceCode' => 'CA',
'PostalCode' => '12345',
'CountryCode' => 'US'
)),
'ShippingChargesPayment' => array(
'PaymentType' => 'SENDER',
'Payor' => array(
'ResponsibleParty' => array(
'AccountNumber' => 'XXXX',
'Contact' => array(
'PersonName' => 'My Name',
'EMailAddress' => 'another@example.com'
)
)
)
),
'LabelSpecification' => array(
'LabelFormatType' => 'COMMON2D',
'ImageType' => 'ZPLII',
'LabelStockType' => 'STOCK_4X6.75_LEADING_DOC_TAB',
'CustomerSpecifiedDetail' => array(
'DocTabContent' => array(
'DocTabContentType' => 'CUSTOM',
'Zone001' => array(
'DocTabZoneSpecifications' => array(
'ZoneNumber' => '201',
'Header' => 'rapidum iaculata',
'DataField' => 'Premere et',
'LiteralValue' => 'Insuper altos',
'Justification' => 'LEFT'
)
)
),
'CustomContentPosition' => 'BELOW',
'CustomContent' => array(
'CoordinateUnits' => 'PIXELS',
'GraphicEntries' => array(
'Position' => array(
'X' => '200',
'Y' => '3'
),
'PrinterGraphicId' => 'aeoliam venit',
'FileGraphicFullName' => 'altos imposuit regemque'
),
'BoxEntries' => array(
'TopLeftCorner' => array(
'X' => '200',
'Y' => '3'
),
'BottomRightCorner' => array(
'X' => '200',
'Y' => '3'
)),
'TextBoxEntries' => array(
'TopLeftCorner' => array(
'X' => '200',
'Y' => '3'
),
'BottomRightCorner' => array(
'X' => '200',
'Y' => '3'
),
'Position' => array(
'X' => '200',
'Y' => '3'
),
'Format' => 'profundum quippe',
'DataFields' => 'premit ac vinclis',
'ThermalFontId' => 'lunctantis ventos',
'FontName' => 'luctantis ventos tempestateque',
'FontSize' => '201',
'Rotation' => 'NONE'
),
'BarcodeEntries' => array(
'Position' => array(
'X' => '200',
'Y' => '3'
),
'Format' => 'altos imposuit',
'DataFields' => 'sonoras imperio premit',
'BarHeight' => '3',
'ThinBarWidth' => '3',
'BarcodeSymbology' => 'CODE128C'
)
)
)
),
'RateRequestTypes' => 'LIST',
'PackageCount' => '1',
'RequestedPackageLineItems' => array(
'SequenceNumber' => '1',
'Weight' => array(
'Units' => 'LB',
'Value' => '40'
),
'Dimensions' => array(
'Length' => '5',
'Width' => '5',
'Height' => '5',
'Units' => 'IN',
),
'PhysicalPackaging' => 'BAG',
'ItemDescription' => 'Phone',
'CustomerReferences' => array(
'CustomerReferenceType' => 'CUSTOMER_REFERENCE',
'Value' => 'NAFTA_COO'
)
)
);
Thanks.