Php 与ZOHO发票集成
我正在探索Zoho发票api,并试图与我的应用程序集成。但是我被卡住了,找不到原因 请帮助: 以下是我调用API的方式:Php 与ZOHO发票集成,php,curl,invoice,zoho,Php,Curl,Invoice,Zoho,我正在探索Zoho发票api,并试图与我的应用程序集成。但是我被卡住了,找不到原因 请帮助: 以下是我调用API的方式: $fields = array( 'contact_name' => urlencode([name]), 'billing_address' => array('address' => urlencode([address]), 'city' => urlencode([
$fields = array(
'contact_name' => urlencode([name]),
'billing_address' => array('address' => urlencode([address]), 'city' => urlencode([city]), 'state' => urlencode([state]), 'zip' => urlencode([pincode]), 'country' => urlencode([country])),
'contact_person_id' => urlencode([id]),
'email' => urlencode([email])
);
$jsonData = json_encode($fields);
//Initialize connection
$ch = curl_init("https://invoice.zoho.com/api/v3/contacts?authtoken=[authtoken]&organization_id=[id]&JSONString={$jsonData}");
curl_setopt($ch, CURLOPT_VERBOSE, 1);//standard i/o streams
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);// Turn off the server and peer verification
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);//Set to return data to string ($response)
curl_setopt($ch, CURLOPT_POST, TRUE);//Regular post
//Execute cUrl session
$response = curl_exec($ch);
curl_close($ch);
我正在发送正确的身份验证令牌和组织密钥
但我得到了这个错误响应:
"code":1048,"message":"Sorry, there was an internal error. Please contact support@zohoinvoice.com for assistance."
任何帮助都将不胜感激。谢谢我没有看到您在代码中发布json数据。将这些添加到您的代码中:
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json") );
curl_setopt($ch, CURLOPT_POSTFIELDS,$jsonData);
我没有看到您在代码中发布json数据。将这些添加到您的代码中:
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json") );
curl_setopt($ch, CURLOPT_POSTFIELDS,$jsonData);
我已经创建了一个示例PHP类,它使用Zoho Invoice API v3在Zoho Invoice中创建Invoice
}我创建了一个示例PHP类,它使用Zoho Invoice API v3在Zoho Invoice中创建发票 }使用$info=curl\u getinfo($ch);然后回声';打印(信息);回声';并查看状态和错误!!!使用$info=curl\u getinfo($ch);然后回声';打印(信息);回声';并查看状态和错误!!!