code error 4 - XMLString should be a part of the request
Hello,
Try to add an invoice from php using curl but I get "
XMLString should be a part of the request"
error.
My code is simple
- $query = urlencode('authtoken='.AUTHTOKEN.'&apikey='.APIKey.'&SCOPE'.scope.'&XMLString='.$xml);
- $x = curl_init("https://invoice.zoho.com/api/invoices/create");
- curl_setopt($x, CURLOPT_HEADER, 0);
- curl_setopt($x, CURLOPT_POST, 1);
- curl_setopt($x, CURLOPT_POSTFIELDS, $query);
- curl_setopt($x, CURLOPT_FOLLOWLOCATION, 0);
- curl_setopt($x, CURLOPT_RETURNTRANSFER, 1);
- $data = curl_exec($x);
- curl_close($x);
- echo $data;
The xml sent is a valid one:
- <Invoice>
- <CustomerID>20</CustomerID>
- <InvoiceDate>2011-09-27</InvoiceDate>
- <InvoiceNumber>TUBI20</InvoiceNumber>
- <PONumber>20</PONumber>
- <ExchangeRate>1</ExchangeRate>
- <LFName>Flat fee daily</LFName>
- <PaymentGateways>
- <PayPal>0</PayPal>
- <Authorize.Net>false</Authorize.Net>
- <GoogleCheckout>false</GoogleCheckout>
- </PaymentGateways>
- <InvoiceItems>
- <InvoiceItem>
- <ItemName>01019112000BR </ItemName>
- <ItemDescription>F.40 NON KAT LOUD EXHAUST + BORDINO </ItemDescription>
- <Price>4051.14</Price>
- <Quantity>1</Quantity>
- </InvoiceItem>
- </InvoiceItems>
- <Comments>
- <Comment><Description></Description></Comment>
- </Comments>
- <Notes></Notes>
- <Terms></Terms>
- </Invoice>
Can anyone help me please?
Thank you!