本文介绍了LendingClub.com API内部服务器在二级市场上购买票据时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图购买Lending club二级市场的票据,并且不断收到内部服务器错误".我也曾多次要求Lending俱乐部提供支持,但他们一无所知.我也尝试过这篇文章,但没有运气在二级市场上购买票据的LendingClub.com API 500错误.

I am attempting to buy Notes of the secondary market of Lending club and I keep getting "Internal server error". I have asked Lending club support multiple times too, but they are clueless. I also tried following this post , but no luck LendingClub.com API 500 Error for Buying Notes on Secondary Market.

请帮助

<?php
$invester_id = "516xxxxxx";
$api_key = "GVsZuxxxxxxxxx"; 
$ContentType = "application/json";
define("DEBUG_LENDING_API", true);

$buy = buy_notes($invester_id, $api_key);
print_r($buy);die;

function buy_notes($invester_id, $api_key){
    $buy_notes_url = "https://api.lendingclub.com/api/investor/v1/accounts/$invester_id/trades/buy";
    $note = array("loanId" => "97277470", "orderId" => "139320895", "noteID" => "149206918", "bidPrice" => "19.45");
    $datas = array("aid" => "70654", "notes" => $note);
    $buy_notes = call_curl($buy_notes_url, $api_key, json_encode($datas));
    $notes = json_decode($buy_notes['data']);
    return $notes;
  }

function call_curl($url, $api_key, $post = "0"){
   $invester_id = "516xxxxxx";
   $ContentType = "application/json";
   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, $url);
   curl_setopt ( $ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9) Gecko/2008052906 Firefox/3.0" );
   if($post != "0"){
     curl_setopt($ch,CURLOPT_POST, 1);
     curl_setopt($ch,CURLOPT_POSTFIELDS, $post);
   }
   curl_setopt ( $ch, CURLOPT_AUTOREFERER, true );
   curl_setopt ( $ch, CURLOPT_FOLLOWLOCATION, true );
   $headers = array();
   $headers[] = "Authorization: $api_key";
   $headers[] = "Content-type: $ContentType";
   $headers[] = "Accept: $ContentType";
   $headers[] = "X-LC-Application-Key: $invester_id";
   //print_r(array_values($headers));
   //exit;
   curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
   $server_output = curl_exec ($ch);
   echo $server_output. "<br>";
   exit;
   $info = curl_getinfo($ch);
   curl_close ($ch);
   if(DEBUG_LENDING_API == true){
     return array("data" => $server_output, "response" => $info);
   }else{
     return json_decode($server_output);
   }
  }
?>

推荐答案

我设法弄清楚了.我将$"aid"设置为$ invester_id,终于成功了.感谢Aynber在此过程中给您的提示.

I managed to figure it out. I set "aid" to $invester_id and that finally did the trick. Thanks Aynber for your tips along the way.

这篇关于LendingClub.com API内部服务器在二级市场上购买票据时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 03:58