douzhou7037 2019-06-05 13:56
浏览 88
已采纳

有没有使用Reloadly API发送通话时间的功能

I have tried reloadly API stated on their doc but no success, i could not find exactly the correct API end point to make Curl call.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://topups.reloadly.com/accounts/balance
");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  "Accept: application/com.reloadly.topups-v1+json",
  "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6Ik0wWXpRa"
));

$response = curl_exec($ch);
curl_close($ch);

var_dump($response);

I got from their their API doc https://topupsapi.docs.apiary.io it stated on sending airtime but no correct endpoint stated. thank

Is there any function or correct endpoint i didn't know about?

  • 写回答

2条回答 默认 最新

  • douhuan6305 2019-06-05 14:14
    关注

    the endpoint is https://topups.reloadly.com/topups , and it's supposed to look something like this:

    $ch = curl_init();
    curl_setopt_array($ch, array(
        CURLOPT_URL => 'https://topups.reloadly.com/topups',
        CURLOPT_POST => 1,
        CURLOPT_HTTPHEADER => array(
            "Accept: application/com.reloadly.topups-v1+json",
            "Content-Type: application/json",
            "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSU",
        ),
        CURLOPT_POSTFIELDS => json_encode(array(
            'recipientPhone' => array(
                'countryCode' => 'HT',
                'number' => '+50936377111',
            ),
            'senderPhone' => array(
                'countryCode' => 'US',
                'number' => '+13059547862',
            ),
            'operatorId' => 173,
            'amount' => 15,
            'customIdentifier' => 'transaction by john@example.com',
        ))
    ));
    curl_exec($ch);
    curl_close($ch);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?