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条)

报告相同问题?

悬赏问题

  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法