Message“:”There was an error processing the request.“,”StackTrace“:”“,”ExceptionType" - JQUERY

懵懂的女人 提交于 2020-01-07 04:23:07

问题


Here is my code, I keep on getting the same error response.

"{"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""}"

I can't figure it out. I'm using Eloqua APIs to get basic information such as total number of accounts, landing pages, users, images, etc. It's weird because I tried the API on POSTMAN application and it did work perfectly Screenshot of postman response to the API

PHP

$objetos = array("data/accounts", "data/contacts", "assets/emails", "assets/landingPages", "assets/images", "assets/forms", "system/users", "assets/microsites", "assets/customObjects");

for ($i = 0; $i < 9; $i++){

   $url = 'http://secure.p03.eloqua.com/API/REST/1.0/' . $objetos[$i] . '?count=1';

   $ch=curl_init();
   curl_setopt($ch,CURLOPT_URL,$url);

   $headers = array(
       'Content-type: application/json',
       'Authorization: BASIC "MY TOKEN"'
   );
   curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

   curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
   curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
   curl_setopt($ch, CURLOPT_CAINFO, getcwd() ."/EloquaApi_lvl1.cer");

   curl_setopt($ch, CURLOPT_POST, 0);
   curl_setopt($ch, CURLOPT_HTTPGET, 1);

   $data[$i] = curl_exec($ch);
   curl_close($ch);
}
echo json_encode($data);

 ?>

JS

function getObjetos(){

$.get("objetos.php", function (data) {
    console.log(data);
}, "json").done(function (data) {
    console.log(data);

// rest of my code 
}

Console console.log response (click for image)


回答1:


Try changing the url http://secure.p03.eloqua.com/API/REST/1.0/ to https



来源:https://stackoverflow.com/questions/44139524/messagethere-was-an-error-processing-the-request-stacktrace-exception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!