【问题标题】:Getting no response on Zoho API CRMZoho API CRM 没有响应
【发布时间】:2013-11-24 15:52:34
【问题描述】:

我正在尝试使用 getSearchRecordsByPDC 方法,可以在这里找到 https://www.zoho.com/crm/help/api/getsearchrecordsbypdc.html#Request_URL

我有这个代码:

private $token = '1234567890abcdefg';
public $responseType = 'xml';

 public function getSearchRecordsByPDC($searchValue,$searchColumn='email')
 {
 $url = "https://crm.zoho.com/crm/private/".$this->responseType."/Leads/getSearchRecordsByPDC?newFormat=1&authtoken=".$this->token."&scope=crmapi&selectColumns=Leads(First Name,Lead Source,Phone,Mobile,Website,Lead Status,Description,Last Name,Website,Email,Lead Owner)&searchColumn=$searchColumn&searchValue=$searchValue";

 $result = $this->curlRequest($url);
 return $result;
 }

 public function curlRequest($url)
 {
 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, $url);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 $output = curl_exec($ch);
 curl_close($ch);
 return $output;
 }

$data = $zoho->getSearchRecordsByPDC('my_email@gmail.com');
print_r($data);

我刚刚发布了一些我的代码的 sn-ps,以使其看起来不会很长。

运行此代码时。我没有收到任何响应,甚至没有收到错误消息或任何消息,例如我收到空白响应、没有 xml 响应或其他任何响应。但是,当我尝试将$url 变量输出复制并粘贴到我的网络浏览器中时,我会收到响应,并且这些响应是有效的。

这有什么问题?对你的帮助表示感谢!谢谢!

【问题讨论】:

    标签: php zoho


    【解决方案1】:

    您似乎在混淆 OOP 和过程代码。试试这个:

    class Zoho {
        private $token = '1234567890abcdefg';
        public $responseType = 'xml';
    
        public function getSearchRecordsByPDC($searchValue,$searchColumn='email')
        {
            $url = "https://crm.zoho.com/crm/private/".$this->responseType."/Leads/getSearchRecordsByPDC?newFormat=1&authtoken=".$this->token."&scope=crmapi&selectColumns=Leads(First Name,Lead Source,Phone,Mobile,Website,Lead Status,Description,Last Name,Website,Email,Lead Owner)&searchColumn=$searchColumn&searchValue=$searchValue";
    
            $result = $this->curlRequest($url);
            return $result;
        }
    
        public function curlRequest($url)
        {
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            $output = curl_exec($ch);
            curl_close($ch);
            return $output;
        }
    }
    
    $zoho = new Zoho;
    $data = $zoho->getSearchRecordsByPDC('my_email@gmail.com');
    print_r($data);
    

    【讨论】:

      猜你喜欢
      • 2019-05-25
      • 2019-11-04
      • 2020-09-20
      • 2016-10-09
      • 2014-04-04
      • 1970-01-01
      • 1970-01-01
      • 2021-06-06
      • 2022-10-04
      相关资源
      最近更新 更多