Jump to content

Need Help in Hiding Response code fro SMS gateway API


Go to solution Solved by Ch0cu3r,

Recommended Posts

Hi All

I have integrated SMS API in PHP page

i am getting some issue like,after submitting the sms I am getting response code which is sample below

 

"919988776699-225d3e2c0d90404bb63dd39ae11e588c"

 

Mobile number along with unique code

 

I want to hide that code,as I am integrating this sms api in opencart page

Please any one help me to resolve this issue to hide the response code

and please find the my code below

 

<?php

 
$sender_id='abcd';           // sender id
$mob_no = "919988776699";//$customer_info['telephone'];       //123, 456 being recepients number
$user = 'username';                      //your account username
$pwd='password';               //your account password
$sms ='Congrats! You have successfully made order Thank You.';
$msg = $sms ;
 $str = trim(str_replace(' ', '%20', $msg));
// to replace the space in message with  ‘%20’
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HEADER,0);
// grab URL and pass it to the browser
//$curl_scraped_page = curl_exec($ch);
curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
?>

 

 

 

Please find the screenshot that this response ID  was appending  in body tag

 

post-182995-0-07563500-1445584826_thumb.png

Hi
here i am posting my index page and sms.php page code
 
Index.php page code
 
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="sms.php" method="get">
<input name="Number" type="text" size="12" maxlength="12" />
<input name="Submit" type="submit" value="submit" />
</form>
</body>
</html>
 
 
and sms.php code
 
<?php


$sender_id='abcd';           // sender id
$mob_no = $_REQUEST["Number"]; //123, 456 being recepients number
$user = 'username';
$pwd='password';               //your account password
$sms ='Hi! You have successfully received message.' Thank You.';
$msg = $sms ;
 $str = trim(str_replace(' ', '%20', $msg));
// to replace the space in message with  ‘%20’
$url="http://login.smsgatewayhub.com/smsapi/pushsms.aspx?user=".$user.'&pwd='.$pwd.'&to='.$mob_no.'&sid='.$sender_id.'&msg='.$str.'&fl=0';
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HEADER,FALSE);
// grab URL and pass it to the browser
$response = curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
$response;


?>
 
here when in enter mobile number and click on submit
I will get response on next page is below
 
919988776699-225d3e2c0d90404bb63dd39ae11e588c
 
if i enter any other number mobile number and unique id will be changed
 
i want to hide the the response after i click submit,user end it should not be visible
 
here you can see the code below i have taken this code with inspect element
the response code directly appending to body tag
 
<html><head></head><body>919988776699-9a4b465119754dbf976fdd9929719af4
</body></html>

 

Edited by navachaitanya
  • Solution

Set the CURLOPT_RETURNTRANSFER option to true

$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HEADER,FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // set to true to have curl return the response, rather than output it directly
// $response will now contain the sms confirmation code
$response = curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);

benanamen

 

Thing is I want hide the whole output,and output should not visible to user

what ever the output was coming after submitting like below(its just a example)

919988776699-225d3e2c0d90404bb63dd39ae11e588c

it should be hided from,user will get sms in their mobile thats it

so thats y i asked for help,I tried in lot of ways but its not working

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.