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

时间:2019-06-05 13:56:17

标签: php curl

我已经尝试过在其文档中说明的可重载API,但没有成功,我找不到完全正确的API端点来进行Curl调用。

$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);

我从他们的API文档https://topupsapi.docs.apiary.io中获得了关于发送通话时间的说明,但未说明正确的端点。谢谢

是否存在我不知道的功能或正确的端点?

2 个答案:

答案 0 :(得分:0)

端点是https://topups.reloadly.com/topups,它应该看起来像这样:

$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 :(得分:0)

<?php
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => 'https://topups.reloadly.com/topups',
CURLOPT_POST => 1,
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "Accept: application/com.reloadly.topups-v1+json",
    "Authorization: Bearer your_access_token")),
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'
    ))
    ));
          $response = curl_exec($ch);
          curl_close($ch);
          echo '<pre>';
          var_dump($response);
          echo '</pre>';
       [enter image description here][1]?>