1

これが私のコードです。同じエラー応答が返され続けます。

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

私はそれを理解することはできません。Eloqua API を使用して、アカウントの総数、ランディング ページ、ユーザー、画像などの基本情報を取得しています。奇妙なことに、POSTMAN アプリケーションで API を試してみたところ、完全に機能しました 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.log 応答 (画像をクリック)

4

1 に答える 1