navachaitanya Posted October 23, 2015 Share Posted October 23, 2015 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’ $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,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 Quote Link to comment Share on other sites More sharing options...
benanamen Posted October 23, 2015 Share Posted October 23, 2015 $val="919988776699-225d3e2c0d90404bb63dd39ae11e588c"; $phone = substr($val,0,12); echo $phone; Quote Link to comment Share on other sites More sharing options...
navachaitanya Posted October 23, 2015 Author Share Posted October 23, 2015 Hi benanamen this value "919988776699-225d3e2c0d90404bb63dd39ae11e588c"; will changes its not static value in opencart when ever customer orders customer will get sms notification on their mobile number Quote Link to comment Share on other sites More sharing options...
navachaitanya Posted October 23, 2015 Author Share Posted October 23, 2015 (edited) 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 October 23, 2015 by navachaitanya Quote Link to comment Share on other sites More sharing options...
Solution Ch0cu3r Posted October 23, 2015 Solution Share Posted October 23, 2015 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); Quote Link to comment Share on other sites More sharing options...
benanamen Posted October 23, 2015 Share Posted October 23, 2015 Your post made it seem like you only wanted the phone number part. Not to get rid of the whole string. Mobile number along with unique code I want to hide that code issue to hide the response code Quote Link to comment Share on other sites More sharing options...
navachaitanya Posted October 23, 2015 Author Share Posted October 23, 2015 Thanks Ch0cu3r its works Thanks A lot Quote Link to comment Share on other sites More sharing options...
navachaitanya Posted October 23, 2015 Author Share Posted October 23, 2015 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.