dongrandi8411 2016-11-02 08:48
浏览 34

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

I'm trying to update a deal in pipedrive CRM using the API. What I'm trying to do is to update the owner of a deal to a new user. But this is not successful.

docs

Here is my code:

$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);

Here is the returned error.

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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
    • ¥15 ETLCloud 处理json多层级问题
    • ¥15 matlab中使用gurobi时报错
    • ¥15 这个主板怎么能扩出一两个sata口
    • ¥15 不是,这到底错哪儿了😭
    • ¥15 2020长安杯与连接网探
    • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
    • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
    • ¥15 可见光定位matlab仿真
    • ¥15 arduino 四自由度机械臂