Execute a url from php page without showing it.
This is what I have: -
function send_sms($receiver,$content)
-
{
-
$logIn = 'raphael';
-
$pwd = 'pwd';
-
$clientId = 'rg7U97fH7fUujp';
-
//$receiver = '238052433258';
-
//$content = 'Just Testing';
-
$Type = 'TEXT';
-
$Sender = 'raphsoft';
-
-
$url = "http://208.77.188.166:8080/server/sendsms/?login=$logIn&password=$pwd&clientid=$clientId&receiver=$receiver&message=$content&message_type=$Type&sender=$Sender";
-
-
$_GET["$url");
-
return
-
}
-
-
if
-
(isset($_POST["send_message"]) && $_POST["send_message"] = "S E N D")
-
{
-
$receiver = $_POST["receiver"];
-
$content = $_POST["contents"];
-
$send_now = send_sms($receiver,$content);
-
-
if (isset($send_now))
-
{
-
$_SESSION["msg"] = "You text message has been sent";
-
}
-
else
-
{
-
$_SESSION["msg"] = "Sorry, the message cannot be sent";
-
}
-
-
navigate("sms_success.php");
-
exit;
-
-
-
}
-
?>
-
11 70588
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
This works but does not hide the url. Please help, it's urgent. -
function send_sms($receiver,$content)
-
{
-
$logIn = 'raphael';
-
$pwd = 'pwd';
-
$clientId = 'rg7U97fH7fUujp';
-
//$receiver = '238052433258';
-
//$content = 'Just Testing';
-
$Type = 'TEXT';
-
$Sender = 'raphsoft';
-
-
$url = "http://208.77.188.166:8080/server/sendsms/?login=$logIn&password=$pwd&clientid=$clientId&receiver=$receiver&message=$content&message_type=$Type&sender=$Sender";
-
-
navigate("$url");
-
}
-
-
if
-
(isset($_POST["send_message"]) && $_POST["send_message"] = "S E N D")
-
{
-
$receiver = $_POST["receiver"];
-
$content = $_POST["contents"];
-
$send_now = send_sms($receiver,$content);
-
-
if (isset($send_now))
-
{
-
$_SESSION["msg"] = "You text message has been sent";
-
}
-
else
-
{
-
$_SESSION["msg"] = "Sorry, the message cannot be sent";
-
}
-
-
navigate("sms_success.php");
-
exit;
-
-
-
}
-
?>
-
Atli 5,058
Expert 4TB
Did you even try either of the methods we suggested?
Both the file_get_contents 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.
Sorry I did. But if u can't help no problem
Atli 5,058
Expert 4TB
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.
That is what I did it did not work -
<?
-
session_start();
-
//include_once('text_class.php');
-
function navigate($page) {echo "<script language='javascript'>location='$page';</script>";exit;}
-
-
function send_sms($receiver,$content)
-
{
-
$logIn = 'user';
-
$pwd = 'pwd';
-
$clientId = '7f7UHfUp';
-
//$receiver = '230528332548';
-
//$content = 'Just Testing';
-
$Type = 'TEXT';
-
$Sender = 'user';
-
-
$url = "http://208.77.188.166:8080/server/sendsms/?login=$logIn&password=$pwd&clientid=$clientId&receiver=$receiver&message=$content&message_type=$Type&sender=$Sender";
-
-
///
-
function curl_get_file_contents($url)
-
{
-
$c = curl_init();
-
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
-
curl_setopt($c, CURLOPT_URL, $URL);
-
$contents = curl_exec($c);
-
curl_close($c);
-
-
if ($contents) return $contents;
-
else return FALSE;
-
}
-
-
curl_get_file_contents("$url");
-
///
-
}
-
-
if
-
(isset($_POST["send_message"]) && $_POST["send_message"] = "S E N D")
-
{
-
$receiver = $_POST["receiver"];
-
$content = $_POST["contents"];
-
$send_now = send_sms($receiver,$content);
-
-
if (isset($send_now))
-
{
-
$_SESSION["msg"] = "You text message has been sent";
-
}
-
else
-
{
-
$_SESSION["msg"] = "Sorry, the message cannot be sent";
-
}
-
-
navigate("sms_success.php");
-
exit;
-
//include_once('http://www.example.net');
-
//exit;
-
-
-
-
}
-
?>
-
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)
I have removed the function the other function. But it is not working yet. -
session_start();
-
//include_once('text_class.php');
-
function navigate($page) {echo "<script language='javascript'>location='$page';</script>";exit;}
-
-
function curl_get_file_contents($url)
-
{
-
$c = curl_init();
-
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
-
curl_setopt($c, CURLOPT_URL, $URL);
-
$contents = curl_exec($c);
-
curl_close($c);
-
-
if ($contents) return $contents;
-
else return FALSE;
-
}
-
-
function send_sms($receiver,$content)
-
{
-
$logIn = 'user';
-
$pwd = 'pwd';
-
$clientId = '7UffUp';
-
//$receiver = '280433232558';
-
//$content = 'Just Testing';
-
$Type = 'TEXT';
-
$Sender = 'user';
-
-
$url = "http://208.77.188.166:8080/server/sendsms/?login=$logIn&password=$pwd&clientid=$clientId&receiver=$receiver&message=$content&message_type=$Type&sender=$Sender";
-
-
///
-
-
curl_get_file_contents("$url");
-
///
-
}
-
-
if
-
(isset($_POST["send_message"]) && $_POST["send_message"] = "S E N D")
-
{
-
$receiver = $_POST["receiver"];
-
$content = $_POST["contents"];
-
$send_now = send_sms($receiver,$content);
-
-
if (isset($send_now))
-
{
-
$_SESSION["msg"] = "You text message has been sent";
-
}
-
else
-
{
-
$_SESSION["msg"] = "Sorry, the message cannot be sent";
-
}
-
-
navigate("sms_success.php");
-
exit;
-
//include_once('http://www.example.net');
-
//exit;
Atli 5,058
Expert 4TB
PHP variables are case-sensitive.
Your $URL in line #9 does not match the parameter $url in line #5.
Try changing that.
Also, your send_sms() function does not return a value. Yet in line #42 you try to check the return value to see if it was successful. You need to add a return value to the function if that is supposed to work.
Add these lines at the top of your script. They will tell you if there are errors in it. -
error_reporting(E_ALL);
-
ini_set('display_errors', true);
Atli, I tried what you said but did not get the right result. Anyway thank you!
Sign in to post your reply or Sign up for a free account.
Similar topics
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. ...
|
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...
|
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...
|
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...
|
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...
|
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.
|
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....
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
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,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |