0

I want to send the SMS to the user using the third party API key in codeigniter. For that I used the file_get_content() But when file runs it takes the more execution time and after display blank page. I also use CURL but same error in codeignator.

This code runs another PHP script only error in codeigniter Following my code:

$to = "thisisprashantkumbhar";
$username ='puretechnology';
$numbers = '9326447272';
$messagenew=rawurlencode($to);
$apikey = 'gdfgrte5-er54-h57f-4rgt-0a7215d15abc';
$url = "http://sms1.businesslead.co.in/sendSMS?username=$username&message=$messagenew&sendername=CMISAM&smstype=TRANS&numbers=$numbers&apikey=$apikey";
$response = file_get_contents($url);
return $response;
3
  • try echo $response; Commented Nov 23, 2016 at 10:49
  • yes I was but nothing prints anything Commented Nov 25, 2016 at 5:51
  • try something like: if(!$response or empty($response))echo 'NO or empty response. ' Commented Nov 25, 2016 at 12:25

2 Answers 2

1
  $stream_options = array(
    'http' => array(
       'method'  => 'GET',
    ),
);
     $context  = stream_context_create($stream_options);
     $response = file_get_contents("http://api.smsbrain.in/1.2/appsms/send.php?user=username&passwd=141414&senderId=SATISH&recipients=9723613143&message=Hello", null, $context);


    echo json_encode($response);
Sign up to request clarification or add additional context in comments.

Comments

0

echo $url and it will show you the complete url then execute url you will get the error. e.g invalid key check your details as well.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.