I've been trying to find solution call getting a PDF version of Invoices via the API and came across this Class, everything works fine when I get Invoice information via XML and json but once I try getting it as a PDF I just get errors
the code Ive used is from the example which is the can be seen below with some slight changes for security reasons.
Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Start tag expected, '<' not found in xero.php on line 266
Warning: simplexml_load_string() [function.simplexml-load-string]: %PDF-1.4 in xero.php on line 266
Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in xero.php on line 266
I've seen this error before when filtering by contact company's with ampersands in them (Bob & sons builders) but little changes to the class to figure out the issue without any luck.
I've been trying to find solution call getting a PDF version of Invoices via the API and came across this Class, everything works fine when I get Invoice information via XML and json but once I try getting it as a PDF I just get errors
the code Ive used is from the example which is the can be seen below with some slight changes for security reasons.
define('XERO_KEY','XXXXXXXXXX');
define('XERO_SECRET','XXXXXXXXXX');
$xero = new Xero(XERO_KEY, XERO_SECRET, 'publickey.cer', 'privatekey.pem', 'pdf' );
$invoice = $xero->Invoices($ID); /header("Content-Length: ".strlen($invoice)); header('Content-Disposition: attachment; filename="invoice.pdf"'); header("Content-type: application/pdf"); header("Content-Transfer-Encoding: binary"); / echo $invoice;
The error I am getting is whats stated below.
Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Start tag expected, '<' not found in xero.php on line 266
Warning: simplexml_load_string() [function.simplexml-load-string]: %PDF-1.4 in xero.php on line 266
Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in xero.php on line 266
I've seen this error before when filtering by contact company's with ampersands in them (Bob & sons builders) but little changes to the class to figure out the issue without any luck.
Anyone got any suggestions?