473,554 Members | 2,810 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

execute a url from php page without showing it

6 New Member
Execute a url from php page without showing it.

This is what I have:
Expand|Select|Wrap|Line Numbers
  1. function send_sms($receiver,$content)
  2. {
  3. $logIn = 'raphael';
  4. $pwd = 'pwd';
  5. $clientId = 'rg7U97fH7fUujp';
  6. //$receiver = '238052433258';
  7. //$content = 'Just Testing';
  8. $Type = 'TEXT';
  9. $Sender = 'raphsoft';
  10.  
  11. $url = "http://208.77.188.166:8080/server/sendsms/?login=$logIn&password=$pwd&clientid=$clientId&receiver=$receiver&message=$content&message_type=$Type&sender=$Sender";
  12.  
  13. $_GET["$url");
  14. return
  15. }
  16.  
  17. if
  18. (isset($_POST["send_message"]) && $_POST["send_message"] = "S E N D")
  19. {
  20. $receiver = $_POST["receiver"];
  21. $content = $_POST["contents"];
  22. $send_now = send_sms($receiver,$content);
  23.  
  24. if (isset($send_now))
  25. {
  26. $_SESSION["msg"] = "You text message has been sent";
  27. }
  28. else
  29. {
  30. $_SESSION["msg"] = "Sorry, the message cannot be sent";
  31. }
  32.  
  33. navigate("sms_success.php");
  34. exit;
  35.  
  36.  
  37. }
  38. ?>
  39.  
Jan 15 '09 #1
11 70637
Dormilich
8,658 Recognized Expert Moderator Expert
Expand|Select|Wrap|Line Numbers
  1. $_GET["$url"];
won't work. $_GET contains the variables present in the url of your current file and the array key for $_GET should be a valid variable name.

to just call the service I guess you should use some of the CURL functions. (PHP: cURL - Manual)

regards
Jan 15 '09 #2
Atli
5,058 Recognized Expert Expert
Hi.

I suggest you try reading this:
PHP: $_GET - Manual

And then this:
PHP: file_get_conten ts - Manual
And if that fails, you could try this:
PHP: cURL - Manual

And finally, if you plan on staying a member on these forums, you should read this:
FAQ: Posting Guidelines - Bytes
Jan 15 '09 #3
raphsoft
6 New Member
This works but does not hide the url. Please help, it's urgent.
Expand|Select|Wrap|Line Numbers
  1. function send_sms($receiver,$content) 
  2. $logIn = 'raphael'; 
  3. $pwd = 'pwd'; 
  4. $clientId = 'rg7U97fH7fUujp'; 
  5. //$receiver = '238052433258'; 
  6. //$content = 'Just Testing'; 
  7. $Type = 'TEXT'; 
  8. $Sender = 'raphsoft'; 
  9.  
  10. $url = "http://208.77.188.166:8080/server/sendsms/?login=$logIn&password=$pwd&clientid=$clientId&receiver=$receiver&message=$content&message_type=$Type&sender=$Sender"; 
  11.  
  12. navigate("$url"); 
  13.  
  14. if 
  15. (isset($_POST["send_message"]) && $_POST["send_message"] = "S E N D") 
  16. $receiver = $_POST["receiver"]; 
  17. $content = $_POST["contents"]; 
  18. $send_now = send_sms($receiver,$content); 
  19.  
  20. if (isset($send_now)) 
  21. $_SESSION["msg"] = "You text message has been sent"; 
  22. else 
  23. $_SESSION["msg"] = "Sorry, the message cannot be sent"; 
  24.  
  25. navigate("sms_success.php"); 
  26. exit; 
  27.  
  28.  
  29. ?>
  30.  
Jan 15 '09 #4
Atli
5,058 Recognized Expert Expert
Did you even try either of the methods we suggested?

Both the file_get_conten ts function and the curl functions are capable of doing what you are asking for.

Don't expect us to simply write the code for you. We wont.
Jan 15 '09 #5
raphsoft
6 New Member
Sorry I did. But if u can't help no problem
Jan 15 '09 #6
Atli
5,058 Recognized Expert Expert
I'm happy to help, but you are going to have to do the heavy lifting mate.

If these two methods didn't work for you, show us what you tried and explain why/how it didn't work.
Error messages and such are always a big help to.

If we knew why those two methods won't working for you, maybe we could suggest alternate solutions.
Jan 15 '09 #7
raphsoft
6 New Member
That is what I did it did not work
Expand|Select|Wrap|Line Numbers
  1. <?
  2. session_start();
  3. //include_once('text_class.php');
  4. function navigate($page) {echo "<script language='javascript'>location='$page';</script>";exit;}
  5.  
  6. function send_sms($receiver,$content)
  7. {
  8. $logIn = 'user';
  9. $pwd = 'pwd';
  10. $clientId = '7f7UHfUp';
  11. //$receiver = '230528332548';
  12. //$content = 'Just Testing';
  13. $Type = 'TEXT';
  14. $Sender = 'user';
  15.  
  16. $url = "http://208.77.188.166:8080/server/sendsms/?login=$logIn&password=$pwd&clientid=$clientId&receiver=$receiver&message=$content&message_type=$Type&sender=$Sender";
  17.  
  18. ///
  19. function curl_get_file_contents($url)
  20.     {
  21.         $c = curl_init();
  22.         curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
  23.         curl_setopt($c, CURLOPT_URL, $URL);
  24.         $contents = curl_exec($c);
  25.         curl_close($c);
  26.  
  27.         if ($contents) return $contents;
  28.             else return FALSE;
  29.     }
  30.  
  31. curl_get_file_contents("$url");
  32. ///
  33. }
  34.  
  35. if
  36. (isset($_POST["send_message"]) && $_POST["send_message"] = "S E N D")
  37. {
  38. $receiver = $_POST["receiver"];
  39. $content = $_POST["contents"];
  40. $send_now = send_sms($receiver,$content);
  41.  
  42. if (isset($send_now))
  43. {
  44. $_SESSION["msg"] = "You text message has been sent";
  45. }
  46. else
  47. {
  48. $_SESSION["msg"] = "Sorry, the message cannot be sent";
  49. }
  50.  
  51. navigate("sms_success.php");
  52. exit;
  53. //include_once('http://www.example.net');
  54. //exit;
  55.  
  56.  
  57.  
  58. }
  59. ?>
  60.  
Jan 15 '09 #8
Dormilich
8,658 Recognized Expert Moderator Expert
although PHP doesn't complain when you define a function inside another function, it seems to be pointless (when I tried it, the inner function wasn't called)
Jan 15 '09 #9
raphsoft
6 New Member
I have removed the function the other function. But it is not working yet.

Expand|Select|Wrap|Line Numbers
  1. session_start();
  2. //include_once('text_class.php');
  3. function navigate($page) {echo "<script language='javascript'>location='$page';</script>";exit;}
  4.  
  5. function curl_get_file_contents($url)
  6.     {
  7.         $c = curl_init();
  8.         curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
  9.         curl_setopt($c, CURLOPT_URL, $URL);
  10.         $contents = curl_exec($c);
  11.         curl_close($c);
  12.  
  13.         if ($contents) return $contents;
  14.             else return FALSE;
  15.     }
  16.  
  17. function send_sms($receiver,$content)
  18. {
  19. $logIn = 'user';
  20. $pwd = 'pwd';
  21. $clientId = '7UffUp';
  22. //$receiver = '280433232558';
  23. //$content = 'Just Testing';
  24. $Type = 'TEXT';
  25. $Sender = 'user';
  26.  
  27. $url = "http://208.77.188.166:8080/server/sendsms/?login=$logIn&password=$pwd&clientid=$clientId&receiver=$receiver&message=$content&message_type=$Type&sender=$Sender";
  28.  
  29. ///
  30.  
  31. curl_get_file_contents("$url");
  32. ///
  33. }
  34.  
  35. if
  36. (isset($_POST["send_message"]) && $_POST["send_message"] = "S E N D")
  37. {
  38. $receiver = $_POST["receiver"];
  39. $content = $_POST["contents"];
  40. $send_now = send_sms($receiver,$content);
  41.  
  42. if (isset($send_now))
  43. {
  44. $_SESSION["msg"] = "You text message has been sent";
  45. }
  46. else
  47. {
  48. $_SESSION["msg"] = "Sorry, the message cannot be sent";
  49. }
  50.  
  51. navigate("sms_success.php");
  52. exit;
  53. //include_once('http://www.example.net');
  54. //exit;
Jan 15 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
4572
by: Metnetsky | last post by:
I'd like to build a function that is executed when someone clicks on an image. Once clicked, I need some parameters passed to a URL which PHP will accept and deal with database connections. Sounds simple, and is simple. The only thing that stumps me is that I do not want that PHP page loaded anywhere that someone would see it. And...
6
2241
by: benny | last post by:
Hi, I have a web pageA, that include the javascript, to do some onload event so that it would load another web pageB to perform some onload action. Could I able to load the pageB without showing it ? Or while loading pageA I would load the pageB onload event using javascript? I have one method i.e. <body onload="window.open("www.try.com",...
0
1299
by: Brian Tkatch | last post by:
Been trying to figure out how to show borderless forms indside an MDI Form, without showing the border at all. Given that (in our case) only one such form needs to show at a time, we were able to put a panel in the (entire) MDI client area and anchor it all around. Then, Show() the panel before opening a form, and after the Form.Show(), do...
4
3672
by: TonyJ | last post by:
Hello! I have a small program that just copy a file and make some checks in main then I just want to inform the user about something by using a MessageBox. I tried to use this in the MessageBox that is located in the main function. This cause compile error because you are not allowed to use this in a static function.
1
1483
by: itsenthil | last post by:
Hi....... I want to print mywebpage in buttonclick control without showing printdialogbox..(i.e withuot user intraction)...the page is submitted directely to the printer .....any way to do this one.....plz help me.....
38
5047
by: ted | last post by:
I have an old link that was widely distributed. I would now like to put a link on that old page that will go to a new page without displaying anything.
0
1282
by: engloon | last post by:
Hi guys. I found this code that read a file then print out. The problem that I'm facing is, I have a lot of files to be printed, so I would like to print without showing the print property menu. Please help. Dim p As New System.Diagnostics.ProcessStartInfo() p.Verb = "print" p.WindowStyle = ProcessWindowStyle.Hidden p.FileName =...
1
3573
by: getmeidea | last post by:
Hi, I have a code like this function printDocument(url) { var newWindow = window.open(<url>, '_blank'); newWindow.print(); setTimeout(<function name>,2000); // code for delaying to complete printing newWindow.close();
3
1480
by: krille | last post by:
Hello fellow developers! I want to print from a webpage without showing any kind of dialog. After some research some ppl say it´s impossible and som say it´s not. In fact I have seen it be done with help of an activex controler. Anyways do anybody know how to do this with c#? I have gotten an activex control working but when i want to print...
0
7573
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7496
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7778
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8008
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7857
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3538
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3525
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1992
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1109
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.