Closed kruegge82 closed 5 years ago
hey @kruegge82 are you able to get shipping rates. I am trying to run example1.php in examples folder, have updated the credentials.php but still i am unable to get complete response.
Try this settings for label generation
try{
if(setEndpoint('changeEndpoint')){
$newLocation = $client->__setLocation(setEndpoint('endpoint'));
}
$response = $client->processShipment($request);
if ($response->HighestSeverity != 'FAILURE' && $response->HighestSeverity != 'ERROR'){
// Create PNG or PDF label
// Set LabelSpecification.ImageType to 'PDF' for generating a PDF label
$fp = fopen($shippingLabel."_".$fetch['orderID'].".pdf", 'wb');
fwrite($fp, ($response->CompletedShipmentDetail->CompletedPackageDetails->Label->Parts->Image));
fclose($fp);
echo 'Label <a href="./'.$shippingLabel."_".$fetch['orderID'].".pdf".'">'.$shippingLabel."_".$fetch['orderID'].".pdf".'</a> was generated.';
}else{
printError($client, $response);
}
writeToLog($client); // Write to log file
} catch (SoapFault $exception) {
printFault($exception, $client);
}
function addLabelSpecification(){
$labelSpecification = array(
'LabelFormatType' => 'COMMON2D', // valid values COMMON2D, LABEL_DATA_ONLY
'ImageType' => 'PDF', // valid values DPL, EPL2, PDF, ZPLII and PNG
'LabelStockType' => 'PAPER_8.5X11_TOP_HALF_LABEL'
);
return $labelSpecification;
}
The ship.php
example has been updated to demonstrate how to save the label to a file.
https://github.com/JeremyDunn/php-fedex-api-wrapper/blob/master/examples/ship.php#L130-L131
hello, i have tested with example/ship.php if i output the result, the object is protected... how can i output the label?
`[Label] => FedEx\ShipService\ComplexType\ShippingDocument Object ( [name:protected] => ShippingDocument [values:protected] => Array ( [Type] => OUTBOUND_LABEL [ShippingDocumentDisposition] => RETURNED [ImageType] => PDF [Resolution] => 200 [CopiesToPrint] => 1 [Parts] => Array ( [0] => FedEx\ShipService\ComplexType\ShippingDocumentPart Object ( [name:protected] => ShippingDocumentPart [values:protected] => Array ( [DocumentPartSequenceNumber] => 1 [Image] => %PDF-1.4 1 0 obj << /Type /Catalog /Pages 3 0 R