pipedrive更新使用php,curl和REST处理put / post请求

时间:2016-11-02 08:48:38

标签: php rest api curl pipedrive-api

我试图使用API​​更新pipedrive CRM中的交易。我想要做的是将交易的所有者更新为新用户。但这并不成功。

docs

这是我的代码:

$deal_id = 31811; //the id of the add that i want to update

$deal = array(
    "user_id" => 1858654, //the id of the user that will be the new owner
    "stage_id" => 1 //the stage id where the deal should be
);

$api_token = "x";
$url = "https://api.pipedrive.com/v1/deals/".$deal_id."?api_token=" . $api_token;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);

curl_setopt($ch, CURLOPT_POSTFIELDS, $deal);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);

这是返回的错误。

array (
  'url' => 'https://api.pipedrive.com/v1/deals/31811?api_token=X',
  'content_type' => NULL,
  'http_code' => 0,
  'header_size' => 0,
  'request_size' => 0,
  'filetime' => -1,
  'ssl_verify_result' => 1,
  'redirect_count' => 0,
  'total_time' => 0.32900000000000001,
  'namelookup_time' => 0,
  'connect_time' => 0.157,
  'pretransfer_time' => 0,
  'size_upload' => 0,
  'size_download' => 0,
  'speed_download' => 0,
  'speed_upload' => 0,
  'download_content_length' => -1,
  'upload_content_length' => -1,
  'starttransfer_time' => 0,
  'redirect_time' => 0,
  'redirect_url' => '',
  'primary_ip' => 'x.x.x.x',
  'certinfo' => 
  array (
  ),
  'primary_port' => x,
  'local_ip' => 'x.x.x.x',
  'local_port' => x,
)error occured during curl exec. Additioanl info: 

0 个答案:

没有答案
相关问题