如何在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);
答案 0 :(得分:0)
我找到了解决方案:添加以下行: curl_setopt($ ch,CURLOPT_POST,false); curl_setopt($ ch,CURLOPT_POSTFIELDS,$ params);