curl_setopt(
$ch,
CURLOPT_HTTPHEADER,
array('Content-Type: multipart/form-data')
);
curl_setopt($ch, CURLOPT_POST, TRUE); // enable posting
curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
//Zoho Exception: {"code":33003,"message":"No Documents have been attached."}
$parameters = $_FILES['form-xlsx'];
//Zoho Exception: {"code":2,"message":"The request passed is not valid."}
$parameters = array(
'content' => new \CurlFile(
__DIR__ . $invoice_attachment,
$_FILES['form-xlsx']['type'],
basename($invoice_attachment)
),
);
//Zoho Exception: {"code":2,"message":"The request passed is not valid."}
$parameters = array(
new \CurlFile(
__DIR__ . $invoice_attachment,
$_FILES['form-xlsx']['type'],
basename($invoice_attachment)
),
);
//Zoho Exception: {"code":33003,"message":"No Documents have been attached."}
$parameters = new \CurlFile(
__DIR__ . $invoice_attachment,
$_FILES['form-xlsx']['type'],
basename($invoice_attachment)
);
//Zoho Exception: {"code":2,"message":"Invalid value passed for content"}
$parameters = array(
'content' => file_get_contents(__DIR__ . $invoice_attachment),
);
//Zoho Exception: {"code":2,"message":"Invalid value passed for 0"}
$parameters = array(
file_get_contents(__DIR__ . $invoice_attachment),
);
//Zoho Exception: {"code":2,"message":"The request passed is not valid."}
$parameters = file_get_contents(__DIR__ . $invoice_attachment);
//Zoho Exception: {"code":2,"message":"Invalid value passed for content"}
$parameters = array(
'content' => base64_encode(
file_get_contents(__DIR__ . $invoice_attachment)
),
);
// Zoho Exception: {"code":2,"message":"Invalid value passed for 0"}
$parameters = array(
base64_encode(
file_get_contents(__DIR__ . $invoice_attachment)
),
);
// Zoho Exception: {"code":2,"message":"The request passed is not valid."}
$parameters = base64_encode(
file_get_contents(__DIR__ . $invoice_attachment)
);
try {
$attachment = $zoho->makeApiRequest(
'invoices/' . $invoice_id . '/attachment',
'POST',
$parameters,
FALSE,
TRUE
);
} catch (Exception $e) {
logger('Zoho Exception', $zoho->lastRequest['dataRaw']);
}
Verbose information:* Hostname books.zoho.com was found in DNS cache * Trying 74.201.154.210... * Connected to books.zoho.com (74.201.154.210) port 443 (#0) * Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH * successfully set certificate verify locations: * CAfile: f:/openserver/modules/php/PHP-5.5/cacert.pem CApath: none * NPN, negotiated HTTP1.1 * SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256 * Server certificate: * subject: C=IN; postalCode=600089; ST=Tamilnadu; L=Chennai; street=Block 7 , DLF IT Park,Ramapuram; O=ZOHO Corporation; OU=ZOHO; OU=PremiumSSL Wildcard; CN=*.zoho.com * start date: 2016-10-12 00:00:00 GMT * expire date: 2017-02-26 23:59:59 GMT * subjectAltName: books.zoho.com matched * issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO SHA-256 Organization Validation Secure Server CA * SSL certificate verify ok. > POST /api/v3/invoices/159812000000849219/attachment?authtoken=68f4de7fed68ef605138c79c8e64e1cc&organization_id=58124894 HTTP/1.1 Host: books.zoho.com Accept: */* Content-Length: 147 Expect: 100-continue Content-Type: multipart/form-data; boundary=------------------------894a5eaf9a450884 < HTTP/1.1 100 Continue < HTTP/1.1 400 Bad Request < Server: ZGS < Date: Tue, 17 Jan 2017 12:40:06 GMT < Content-Type: application/json;charset=UTF-8 < Transfer-Encoding: chunked < Connection: keep-alive < Set-Cookie: d963a4f87b=4ee0acb6d94af1624d87fd7fda6f8d92; Path=/ < X-XSS-Protection: 1 < X-Content-Type-Options: nosniff < Set-Cookie: zbcscook=9e775632-3428-47ac-bf42-a1dcfb2ad531; Path=/; Secure < Pragma: no-cache < Cache-Control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0 < Expires: Thu, 01 Jan 1970 00:00:00 GMT < X-Frame-Options: NONE < Set-Cookie: JSESSIONID=2B6C22E834493F5A2C9FED42A7612CA3; Path=/; Secure; HttpOnly < X-Rate-Limit-Limit: 2500 < X-Rate-Limit-Reset: 58793 < X-Rate-Limit-Remaining: 2349 < Content-Disposition: attachment; < Allow: OPTIONS, POST, GET, DELETE, PUT < Set-Cookie: BuildCookie_58124894=1; Expires=Tue, 17-Jan-2017 12:45:06 GMT; Secure < BUILD_VERSION: Jan_16_2017_2347 < CLIENT_BUILD_VERSION: Jan_16_2017_2347 < SERVER_BUILD_VERSION: Jan_10_2017_1_21185/ < Vary: Accept-Encoding * HTTP error before end of send, stop sending < * Closing connection 0Zoho Exception: {"code":33003,"message":"No Documents have been attached."}