SMS Sending by SSL Connection

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stefan Richter

    SMS Sending by SSL Connection

    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=$pass word&api_id=$ap i_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>mes sage ID: ". $send[1];
    else
    echo "send message failed";
    } else {
    echo "Authentica tion failure: ". $ret[0];
    exit();
    }
    ?>
  • Jochen Daum

    #2
    Re: SMS Sending by SSL Connection

    Hi,

    On 6 Apr 2004 16:57:06 -0700, Dooing@gmx.de (Stefan Richter) wrote:
    [color=blue]
    >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 ???
    >[/color]
    Try the curl extension, or maybe Snoopy on Sourceforge. Both do SSL.

    HTH, Jochen

    [color=blue]
    >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=$pass word&api_id=$ap i_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>mes sage ID: ". $send[1];
    >else
    >echo "send message failed";
    >} else {
    >echo "Authentica tion failure: ". $ret[0];
    >exit();
    >}
    >?>[/color]

    --
    Jochen Daum - Cabletalk Group Ltd.
    PHP DB Edit Toolkit -- PHP scripts for building
    database editing interfaces.
    Download PHP DB Edit Toolkit for free. PHP DB Edit Toolkit is a set of PHP classes makes the generation of database edit interfaces easier and faster. The main class builds tabular and form views based on a data dictionary and takes over handling of insert/update/delete and user input.

    Comment

    • Stefan Schneider

      #3
      Re: SMS Sending by SSL Connection

      I saw something about curl before.
      Though - what is curl???


      "Jochen Daum" <jochen.daum@ca bletalk.co.nz> schrieb im Newsbeitrag
      news:afh670df4b im1g5lmta2931ir mg5auldmi@4ax.c om...[color=blue]
      > Hi,
      >
      > On 6 Apr 2004 16:57:06 -0700, Dooing@gmx.de (Stefan Richter) wrote:
      >[color=green]
      > >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 ???
      > >[/color]
      > Try the curl extension, or maybe Snoopy on Sourceforge. Both do SSL.
      >
      > HTH, Jochen
      >
      >[color=green]
      > >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=$pass word&api_id=$ap i_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>mes sage ID: ". $send[1];
      > >else
      > >echo "send message failed";
      > >} else {
      > >echo "Authentica tion failure: ". $ret[0];
      > >exit();
      > >}
      > >?>[/color]
      >
      > --
      > Jochen Daum - Cabletalk Group Ltd.
      > PHP DB Edit Toolkit -- PHP scripts for building
      > database editing interfaces.
      > http://sourceforge.net/projects/phpdbedittk/[/color]


      Comment

      • Jochen Daum

        #4
        Re: SMS Sending by SSL Connection

        Hi,

        On Wed, 7 Apr 2004 02:12:20 +0200, "Stefan Schneider"
        <marcus@site-ezy.com> wrote:
        [color=blue]
        >I saw something about curl before.
        >Though - what is curl???[/color]

        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

        [color=blue]
        >
        >
        >"Jochen Daum" <jochen.daum@ca bletalk.co.nz> schrieb im Newsbeitrag
        >news:afh670df4 bim1g5lmta2931i rmg5auldmi@4ax. com...[color=green]
        >> Hi,
        >>
        >> On 6 Apr 2004 16:57:06 -0700, Dooing@gmx.de (Stefan Richter) wrote:
        >>[color=darkred]
        >> >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 ???
        >> >[/color]
        >> Try the curl extension, or maybe Snoopy on Sourceforge. Both do SSL.
        >>
        >> HTH, Jochen
        >>
        >>[color=darkred]
        >> >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=$pass word&api_id=$ap i_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>mes sage ID: ". $send[1];
        >> >else
        >> >echo "send message failed";
        >> >} else {
        >> >echo "Authentica tion failure: ". $ret[0];
        >> >exit();
        >> >}
        >> >?>[/color]
        >>
        >> --
        >> Jochen Daum - Cabletalk Group Ltd.
        >> PHP DB Edit Toolkit -- PHP scripts for building
        >> database editing interfaces.
        >> http://sourceforge.net/projects/phpdbedittk/[/color]
        >[/color]

        --
        Jochen Daum - Cabletalk Group Ltd.
        PHP DB Edit Toolkit -- PHP scripts for building
        database editing interfaces.
        Download PHP DB Edit Toolkit for free. PHP DB Edit Toolkit is a set of PHP classes makes the generation of database edit interfaces easier and faster. The main class builds tabular and form views based on a data dictionary and takes over handling of insert/update/delete and user input.

        Comment

        • Stefan Richter

          #5
          Re: SMS Sending by SSL Connection

          Just checked - it's not installed on our server, and I doubt
          it will be.

          Is there a way to do without???

          Stefan


          Comment

          • Jochen Daum

            #6
            Re: SMS Sending by SSL Connection

            Hi,


            On Wed, 7 Apr 2004 03:35:45 +0200, "Stefan Richter"
            <marcus@site-ezy.com> wrote:
            [color=blue]
            >Just checked - it's not installed on our server, and I doubt
            >it will be.
            >
            >Is there a way to do without???[/color]


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

            Jochen[color=blue]
            >
            >Stefan
            >[/color]

            --
            Jochen Daum - Cabletalk Group Ltd.
            PHP DB Edit Toolkit -- PHP scripts for building
            database editing interfaces.
            Download PHP DB Edit Toolkit for free. PHP DB Edit Toolkit is a set of PHP classes makes the generation of database edit interfaces easier and faster. The main class builds tabular and form views based on a data dictionary and takes over handling of insert/update/delete and user input.

            Comment

            • Stefan Richter

              #7
              Re: SMS Sending by SSL Connection

              No, I can't install anything new at all.

              Stefan


              Comment

              • Gordon Burditt

                #8
                Re: SMS Sending by SSL Connection

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

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

                Gordon L. Burditt

                Comment

                • Manuel Lemos

                  #9
                  Re: SMS Sending by SSL Connection

                  Hello,

                  On 04/06/2004 08:57 PM, Stefan Richter wrote:[color=blue]
                  > 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.[/color]

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

                  Class: Clickatell SMS API


                  --

                  Regards,
                  Manuel Lemos

                  PHP Classes - Free ready to use OOP components written in PHP
                  Free PHP Classes and Objects 2025 Versions with PHP Example Scripts, PHP Tutorials, Download PHP Scripts, PHP articles, Remote PHP Jobs, Hire PHP Developers, PHP Book Reviews, PHP Language OOP Materials


                  PHP Reviews - Reviews of PHP books and other products


                  Metastorage - Data object relational mapping layer generator

                  Comment

                  • Stefan Richter

                    #10
                    Re: SMS Sending by SSL Connection

                    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...


                    Comment

                    • Stefan Richter

                      #11
                      Re: SMS Sending by SSL Connection

                      Clickatell provides https on their server,
                      but I am not allowed to install a lib on our server,
                      the one that contacts clickatells server.


                      Comment

                      • Jochen Daum

                        #12
                        Re: SMS Sending by SSL Connection

                        Stefan,

                        On Wed, 7 Apr 2004 04:21:24 +0200, "Stefan Richter"
                        <marcus@site-ezy.com> wrote:
                        [color=blue]
                        >No, I can't install anything new at all.[/color]


                        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.
                        Download PHP DB Edit Toolkit for free. PHP DB Edit Toolkit is a set of PHP classes makes the generation of database edit interfaces easier and faster. The main class builds tabular and form views based on a data dictionary and takes over handling of insert/update/delete and user input.

                        Comment

                        • Stefan Richter

                          #13
                          Re: SMS Sending by SSL Connection

                          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


                          Comment

                          • Jochen Daum

                            #14
                            Re: SMS Sending by SSL Connection

                            On Wed, 7 Apr 2004 07:18:23 +0200, "Stefan Richter"
                            <marcus@site-ezy.com> wrote:
                            [color=blue]
                            >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???
                            >[/color]

                            I'm really getting concerned now. I think you still have not entered[color=blue][color=green][color=darkred]
                            >>>Snoopy sourceforge<<< into Google and I'm not gonna do it for you.[/color][/color][/color]

                            HTH,

                            Jochen
                            --
                            Jochen Daum - Cabletalk Group Ltd.
                            PHP DB Edit Toolkit -- PHP scripts for building
                            database editing interfaces.
                            Download PHP DB Edit Toolkit for free. PHP DB Edit Toolkit is a set of PHP classes makes the generation of database edit interfaces easier and faster. The main class builds tabular and form views based on a data dictionary and takes over handling of insert/update/delete and user input.

                            Comment

                            • R. Rajesh Jeba Anbiah

                              #15
                              Re: SMS Sending by SSL Connection

                              Jochen Daum <jochen.daum@ca bletalk.co.nz> wrote in message news:<lp3770l80 0kqfjce6c3a6g9c mcumu7enqb@4ax. com>...[color=blue]
                              > On Wed, 7 Apr 2004 07:18:23 +0200, "Stefan Richter"
                              > <marcus@site-ezy.com> wrote:
                              >[color=green]
                              > >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???
                              > >[/color]
                              >
                              > I'm really getting concerned now. I think you still have not entered[color=green][color=darkred]
                              > >>>Snoopy sourceforge<<< into Google and I'm not gonna do it for you.[/color][/color][/color]

                              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

                              Comment

                              Working...