如何在SurveyMonkey中按名称获取调查ID

时间:2017-08-28 10:08:08

标签: php api surveymonkey

如何在SurveyMonkey中按名称获取调查ID? 这是找到的,但如何将其转换为PHP?

curl -i -X POST -H"授权:bearer YOUR_ACCESS_TOKEN" -H" Content-Type":" application / json" https://api.surveymonkey.net/v3/surveys -d' {"标题":"新调查"}'

这是我没有传递调查标题参数的基本api调用:

<?php
$requestHeaders = array(
    'Content-Type: application/json',
    'Authorization: Bearer 12345',
);

$url = 'https://api.surveymonkey.net/v3/surveys/';
$ch  = curl_init();
curl_setopt($ch, CURLOPT_URL, $url_contactlist);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $requestHeaders);
?>

感谢。

解决方案:

添加

curl_setopt($ch, CURLOPT_POST, false); 
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);

1 个答案:

答案 0 :(得分:0)

我找到了解决方案:添加以下行: curl_setopt($ ch,CURLOPT_POST,false); curl_setopt($ ch,CURLOPT_POSTFIELDS,$ params);