【发布时间】:2017-08-30 22:54:14
【问题描述】:
我正在尝试实现this API 方法并使用 PHP cURL 发送 GET 请求。
这是我的代码:
$url = 'https://crm.zoho.com/crm/private/xml/'.$module.'/'.$method.'?authtoken='.config('app.ZOHO_KEY').'&scope=crmapi&newFormat=1&id='.$record_id.'&xmlData='.$XML_data;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
URL 计算如下:
https://crm.zoho.com/crm/private/xml/Contacts/updateRecords?authtoken=XXXX&scope=crmapi&newFormat=1&id=2410575000000139003&xmlData= <Contacts> <row no="1"> <FL val="Email Opt Out">true</FL> </row> </Contacts>
但是,请求失败。我试过str_replace(' ', '%20', $url),但这并不能解决问题。
【问题讨论】:
-
数据在正文中而不是在 url 中发送