By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,759 Members | 1,778 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,759 IT Pros & Developers. It's quick & easy.

SMS Sending by SSL Connection

P: n/a
Hi, I would like to conect to a server by a SSL Conection,
to send an SMS.
The company that offers the SMS service provided some Code for a http
connection, but not for a https connection.

Here is the code to send an SMS by http, which works great.
Can you help / or do you know a good tutorial / website for php and
ssl ???

thanx,
marcus
<?
$user = "user";
$password = "password";
$api_id = "xxxx";
$baseurl ="http://api.clickatell.com";
$text = urlencode("This is an example message");
$to = "0123456789";
// auth call
$url = "$baseurl/http/auth?user=$user&password=$password&api_id=$api_id" ;
// do auth call
$ret = file($url);
// split our response. return string is on first line of the data
returned
$sess = split(":",$ret[0]);
if ($sess[0] == "OK") {
$sess_id = trim($sess[1]); // remove any whitespace
$url = "$baseurl/http/sendmsg?session_id=$sess_id&to=$to&text=$text";
// do sendmsg call
$ret = file($url);
$send = split(":",$ret[0]);
if ($send[0] == "ID")
echo "success<br>message ID: ". $send[1];
else
echo "send message failed";
} else {
echo "Authentication failure: ". $ret[0];
exit();
}
?>
Jul 17 '05 #1
Share this Question
Share on Google+
17 Replies


P: n/a
Hi,

On 6 Apr 2004 16:57:06 -0700, Do****@gmx.de (Stefan Richter) wrote:
Hi, I would like to conect to a server by a SSL Conection,
to send an SMS.
The company that offers the SMS service provided some Code for a http
connection, but not for a https connection.

Here is the code to send an SMS by http, which works great.
Can you help / or do you know a good tutorial / website for php and
ssl ???
Try the curl extension, or maybe Snoopy on Sourceforge. Both do SSL.

HTH, Jochen

thanx,
marcus
<?
$user = "user";
$password = "password";
$api_id = "xxxx";
$baseurl ="http://api.clickatell.com";
$text = urlencode("This is an example message");
$to = "0123456789";
// auth call
$url = "$baseurl/http/auth?user=$user&password=$password&api_id=$api_id" ;
// do auth call
$ret = file($url);
// split our response. return string is on first line of the data
returned
$sess = split(":",$ret[0]);
if ($sess[0] == "OK") {
$sess_id = trim($sess[1]); // remove any whitespace
$url = "$baseurl/http/sendmsg?session_id=$sess_id&to=$to&text=$text";
// do sendmsg call
$ret = file($url);
$send = split(":",$ret[0]);
if ($send[0] == "ID")
echo "success<br>message ID: ". $send[1];
else
echo "send message failed";
} else {
echo "Authentication failure: ". $ret[0];
exit();
}
?>


--
Jochen Daum - Cabletalk Group Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 17 '05 #2

P: n/a
I saw something about curl before.
Though - what is curl???
"Jochen Daum" <jo*********@cabletalk.co.nz> schrieb im Newsbeitrag
news:af********************************@4ax.com...
Hi,

On 6 Apr 2004 16:57:06 -0700, Do****@gmx.de (Stefan Richter) wrote:
Hi, I would like to conect to a server by a SSL Conection,
to send an SMS.
The company that offers the SMS service provided some Code for a http
connection, but not for a https connection.

Here is the code to send an SMS by http, which works great.
Can you help / or do you know a good tutorial / website for php and
ssl ???

Try the curl extension, or maybe Snoopy on Sourceforge. Both do SSL.

HTH, Jochen

thanx,
marcus
<?
$user = "user";
$password = "password";
$api_id = "xxxx";
$baseurl ="http://api.clickatell.com";
$text = urlencode("This is an example message");
$to = "0123456789";
// auth call
$url = "$baseurl/http/auth?user=$user&password=$password&api_id=$api_id" ;
// do auth call
$ret = file($url);
// split our response. return string is on first line of the data
returned
$sess = split(":",$ret[0]);
if ($sess[0] == "OK") {
$sess_id = trim($sess[1]); // remove any whitespace
$url = "$baseurl/http/sendmsg?session_id=$sess_id&to=$to&text=$text";
// do sendmsg call
$ret = file($url);
$send = split(":",$ret[0]);
if ($send[0] == "ID")
echo "success<br>message ID: ". $send[1];
else
echo "send message failed";
} else {
echo "Authentication failure: ". $ret[0];
exit();
}
?>


--
Jochen Daum - Cabletalk Group Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/

Jul 17 '05 #3

P: n/a
Hi,

On Wed, 7 Apr 2004 02:12:20 +0200, "Stefan Schneider"
<ma****@site-ezy.com> wrote:
I saw something about curl before.
Though - what is curl???
Its a library that handles all kind of internet protocols, HTTP, FTP,
telnet etc.

There's an extension in php. Check out www.php.net and Google.

HTH, Jochen



"Jochen Daum" <jo*********@cabletalk.co.nz> schrieb im Newsbeitrag
news:af********************************@4ax.com.. .
Hi,

On 6 Apr 2004 16:57:06 -0700, Do****@gmx.de (Stefan Richter) wrote:
>Hi, I would like to conect to a server by a SSL Conection,
>to send an SMS.
>The company that offers the SMS service provided some Code for a http
>connection, but not for a https connection.
>
>Here is the code to send an SMS by http, which works great.
>Can you help / or do you know a good tutorial / website for php and
>ssl ???
>

Try the curl extension, or maybe Snoopy on Sourceforge. Both do SSL.

HTH, Jochen

>thanx,
>marcus
>
>
><?
>$user = "user";
>$password = "password";
>$api_id = "xxxx";
>$baseurl ="http://api.clickatell.com";
>$text = urlencode("This is an example message");
>$to = "0123456789";
>// auth call
>$url = "$baseurl/http/auth?user=$user&password=$password&api_id=$api_id" ;
>// do auth call
>$ret = file($url);
>// split our response. return string is on first line of the data
>returned
>$sess = split(":",$ret[0]);
>if ($sess[0] == "OK") {
>$sess_id = trim($sess[1]); // remove any whitespace
>$url = "$baseurl/http/sendmsg?session_id=$sess_id&to=$to&text=$text";
>// do sendmsg call
>$ret = file($url);
>$send = split(":",$ret[0]);
>if ($send[0] == "ID")
>echo "success<br>message ID: ". $send[1];
>else
>echo "send message failed";
>} else {
>echo "Authentication failure: ". $ret[0];
>exit();
>}
>?>


--
Jochen Daum - Cabletalk Group Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/


--
Jochen Daum - Cabletalk Group Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 17 '05 #4

P: n/a
Just checked - it's not installed on our server, and I doubt
it will be.

Is there a way to do without???

Stefan
Jul 17 '05 #5

P: n/a
Hi,
On Wed, 7 Apr 2004 03:35:45 +0200, "Stefan Richter"
<ma****@site-ezy.com> wrote:
Just checked - it's not installed on our server, and I doubt
it will be.

Is there a way to do without???

I think I have mentioned Snoopy on Sourceforge. Have you looked that
up as well?

Jochen
Stefan


--
Jochen Daum - Cabletalk Group Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 17 '05 #6

P: n/a
No, I can't install anything new at all.

Stefan
Jul 17 '05 #7

P: n/a
>Hi, I would like to conect to a server by a SSL Conection,
to send an SMS.
The company that offers the SMS service provided some Code for a http
connection, but not for a https connection.


If the company does not provide https on their server,
code on your end won't help.

Gordon L. Burditt
Jul 17 '05 #8

P: n/a
Hello,

On 04/06/2004 08:57 PM, Stefan Richter wrote:
Hi, I would like to conect to a server by a SSL Conection,
to send an SMS.
The company that offers the SMS service provided some Code for a http
connection, but not for a https connection.


There is no need to reinvent the wheel. Here is a class that does
exactly what you want:

Class: Clickatell SMS API
http://www.phpclasses.org/smsapi

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
Jul 17 '05 #9

P: n/a
Hi Manuel,

just had a short look on it,
and it really seems to be exactly what I need -
though it also talks about curl -
does that mean that the php file has curl code included,
or does it mean that I still need to install the curl library,
which my supervisor doesn't want me to...
Jul 17 '05 #10

P: n/a
Clickatell provides https on their server,
but I am not allowed to install a lib on our server,
the one that contacts clickatells server.
Jul 17 '05 #11

P: n/a
Stefan,

On Wed, 7 Apr 2004 04:21:24 +0200, "Stefan Richter"
<ma****@site-ezy.com> wrote:
No, I can't install anything new at all.

And that tells me that you haven't looked, because its just a bunch of
PHP scripts.

Jochen
--
Jochen Daum - Cabletalk Group Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 17 '05 #12

P: n/a
Oh god I am looking for an example the whole day already!!!
If you know one, could you be so nice to tell me the adress???

Stefan
Jul 17 '05 #13

P: n/a
On Wed, 7 Apr 2004 07:18:23 +0200, "Stefan Richter"
<ma****@site-ezy.com> wrote:
Oh god I am looking for an example the whole day already!!!
If you know one, could you be so nice to tell me the adress???


I'm really getting concerned now. I think you still have not entered
Snoopy sourceforge<<< into Google and I'm not gonna do it for you.


HTH,

Jochen
--
Jochen Daum - Cabletalk Group Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 17 '05 #14

P: n/a
Jochen Daum <jo*********@cabletalk.co.nz> wrote in message news:<lp********************************@4ax.com>. ..
On Wed, 7 Apr 2004 07:18:23 +0200, "Stefan Richter"
<ma****@site-ezy.com> wrote:
Oh god I am looking for an example the whole day already!!!
If you know one, could you be so nice to tell me the adress???


I'm really getting concerned now. I think you still have not entered
Snoopy sourceforge<<< into Google and I'm not gonna do it for you.


IIRC, Snoopy requires the command line cURL. The OP says he cannot
install anything on his server. So, I'm skeptical that he may not even
use Snoopy either.

The cURL alternative will be fsockopen()
<http://in2.php.net/fsockopen> . The recent PHP versions support
ssl://, but I think for that we need to have openssl enabled.

--
http://www.sendmetoindia.com - Send Me to India!
Email: rrjanbiah-at-Y!com
Jul 17 '05 #15

P: n/a
On Wed, 07 Apr 2004 17:20:32 +1200, Jochen Daum wrote:
On Wed, 7 Apr 2004 07:18:23 +0200, "Stefan Richter"
<ma****@site-ezy.com> wrote:
Oh god I am looking for an example the whole day already!!!
If you know one, could you be so nice to tell me the adress???


I'm really getting concerned now. I think you still have not entered
Snoopy sourceforge<<< into Google and I'm not gonna do it for you.


HTH,

Jochen

He's a waste of space Jochen... look at the way he posts.. think that he
_really_ understands PHP if he can't even quote / post correctly? =)

Some people are worth helping / advising in this world.. normally the ones
that actualy _listen_ to the help / advice.. not bevave like Stephan here.
It's sad really.

Regards,

Ian

--
Ian.H
digiServ Network
London, UK
http://digiserv.net/

Jul 17 '05 #16

P: n/a
Hi Rajesh,

On 7 Apr 2004 03:26:21 -0700, ng**********@rediffmail.com (R. Rajesh
Jeba Anbiah) wrote:
Jochen Daum <jo*********@cabletalk.co.nz> wrote in message news:<lp********************************@4ax.com>. ..
On Wed, 7 Apr 2004 07:18:23 +0200, "Stefan Richter"
<ma****@site-ezy.com> wrote:
>Oh god I am looking for an example the whole day already!!!
>If you know one, could you be so nice to tell me the adress???
>


I'm really getting concerned now. I think you still have not entered
>>>Snoopy sourceforge<<< into Google and I'm not gonna do it for you.


IIRC, Snoopy requires the command line cURL. The OP says he cannot
install anything on his server. So, I'm skeptical that he may not even
use Snoopy either.


I used Snoopy on a server without curl.

HTH, Jochen
--
Jochen Daum - Cabletalk Group Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 17 '05 #17

P: n/a
Jochen Daum <jo*********@cabletalk.co.nz> wrote in message news:<0s********************************@4ax.com>. ..
Hi Rajesh,

On 7 Apr 2004 03:26:21 -0700, ng**********@rediffmail.com (R. Rajesh
Jeba Anbiah) wrote:
Jochen Daum <jo*********@cabletalk.co.nz> wrote in message news:<lp********************************@4ax.com>. ..
On Wed, 7 Apr 2004 07:18:23 +0200, "Stefan Richter"
<ma****@site-ezy.com> wrote:

>Oh god I am looking for an example the whole day already!!!
>If you know one, could you be so nice to tell me the adress???
>

I'm really getting concerned now. I think you still have not entered
>>>Snoopy sourceforge<<< into Google and I'm not gonna do it for you.


IIRC, Snoopy requires the command line cURL. The OP says he cannot
install anything on his server. So, I'm skeptical that he may not even
use Snoopy either.


I used Snoopy on a server without curl.


I think, that might be the old version (one without ssl support eg.
<http://turma.sourceforge.net/web/urlator/snoopy.html>).

Just checked their changelog:

Version 0.94
------------
- Added SSL support via cURL
<snip>

And in recent v1.01 <http://sourceforge.net/projects/snoopy/>, they
use commandline cURL for ssl.

--
http://www.sendmetoindia.com - Send Me to India!
Email: rrjanbiah-at-Y!com
Jul 17 '05 #18

This discussion thread is closed

Replies have been disabled for this discussion.