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 69342
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: getmeidea |
last post by:
Hi,
I have a code like this
function printDocument(url) {
var newWindow = window.open(<url>, '_blank');
newWindow.print();
...
|
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...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
|
by: Carina712 |
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...
| |