-1

How do I use the following example curl to send an actual SMS with PHP?

// -- Sending Direct SMS --
curl -X "POST" "https://api.ringcaptcha.com/APP_KEY/sms" \
-d "api_key=API_KEY" \
-d "phone=TO_NUMBER" \
-d "message=Hi there! This is a test message from
RingCaptcha."
Niellles
  • 843
  • 10
  • 25
  • 1
    Possible duplicate of [PHP + curl, HTTP POST sample code?](https://stackoverflow.com/questions/2138527/php-curl-http-post-sample-code) – Philipp Jul 07 '18 at 19:31

1 Answers1

0

At last Worked :)

    $data = array(
        'api_key'=>'{api_key}',
        'phone'=>'{number}'
    );

    $string = http_build_query($data);
    $ch = curl_init("https://api.ringcaptcha.com/{key}/code/sms");

    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS,$string);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $server_output = curl_exec($ch);
    curl_close ($ch);
    print_r($server_output);