I think it is something simple that has to do with my paths, because when I just create the files in the current folder, everything works. That being said, I am pretty unfamiliar with fopen(), fwrite(), and fclose(). The errors I am getting are (I think once the first one is fixed, the rest will work, too):
Warning: fopen(test/b/shipLabels/1_8154_0.pdf) [function.fopen]: failed to open stream: No such file or directory in /public_html/test/b/lib/FedEx/ShipWebServiceClient/Ground/Domestic MPS/ShipWebServiceClient.php5 on line 116
Warning: fwrite() expects parameter 1 to be resource, boolean given in /public_html/test/b/lib/FedEx/ShipWebServiceClient/Ground/Domestic MPS/ShipWebServiceClient.php5 on line 117
Warning: fclose() expects parameter 1 to be resource, boolean given in /public_Html/test/b/lib/FedEx/ShipWebServiceClient/Ground/Domestic MPS/ShipWebServiceClient.php5 on line 118
The lines that references are:
$fp = fopen(SHIP_MASTERLABEL, 'wb');
fwrite($fp, ($masterResponse->CompletedShipmentDetail->CompletedPackageDetails->Label->Parts->Image));
fclose($fp);
I define SHIP_MASTERLABEL using this:
define('SHIP_MASTERLABEL', 'test/b/shipLabels/'.$clientId.'_'.$invoiceId.'_0.pdf');
In this case, $clientId=1, $invoiceId=8154. For the most part, this syntax has been provided by the FedEx docs.
Thanks so much for your help!
/test/b/lib/FedEx/ShipWebServiceClient/Ground/Domestic MPS/test/b/shipLabels/1_8154_0.pdf
And this file is Probably not existing – j_s_stackWarning: fopen(../../../../../../test/b/shipLabels/1_8154_0.pdf) [function.fopen]: failed to open stream: No such file or directory in /home/guysandd/public_html/test/b/lib/FedEx/ShipWebServiceClient/Ground/Domestic MPS/ShipWebServiceClient.php5 on line 116.
Is there some way to correctly go up a path in the define() function? – radleybobins