Please reply me

Closed
lsha Posts 2 Registration date Wednesday October 7, 2009 Status Member Last seen October 12, 2009 - Oct 8, 2009 at 02:15 AM
lsha Posts 2 Registration date Wednesday October 7, 2009 Status Member Last seen October 12, 2009 - Oct 12, 2009 at 07:02 AM
Hello friends

Is it possible to send sms through the php code

2 responses

Blocked Profile
Oct 8, 2009 at 02:28 AM
Dear Isha,

It is indeed possible to send sms through php code.

Following is a sample that will help you understand how to do it.

<?php

//First prepare the info that relates to the connection

$host = "tm4b.com";

//although you can use an ip address, it is easier to just use tm4b.com

$request_length = strlen($request);

// when we post the header, we have to also include it's length

$script = "/client/api/send.php";

$method = "POST";

//Replace with "GET" if required.

if($method=="GET") $script .= "?$request";

//Appends the request if "GET" is being used.

//Now comes the header which we are going to post. This is where our messages details will be sent over.

$header = "$method

$script HTTP/1.1rn".

//"Host: $hostrn". "User-Agent: HTTP/1.1rn". "Content-Type: application/x-www-form-urlencodedrn". "Content-Length: $request_lengthrn". "Connection: closernrn". "$requestrn";

//Now we open up the connection

$socket = @fsockopen($host, 80, $errno, $errstr);

if ($socket) //if its open, then...

{ fputs($socket, $header);

// send the details over

while(!feof($socket)) $output[] = fgets($socket);



//get the results

fclose($socket);

}

//print_r($output);

//the message id's will be kept in one of the $output values

?>

Hope that this helps you in your task.

Thanks in advance.
0
lsha Posts 2 Registration date Wednesday October 7, 2009 Status Member Last seen October 12, 2009
Oct 12, 2009 at 07:02 AM
Thank you
0