www.webdeveloper.com
Page 4 of 5 FirstFirst ... 2345 LastLast
Results 46 to 60 of 62

Thread: Send SMS (text messages) via PHP

  1. #46
    Join Date
    Sep 2005
    Posts
    1,636
    Yes this is question. How to do double sided as you need provider (gatway).

  2. #47
    Join Date
    Jun 2008
    Location
    Europe
    Posts
    1,114
    There is a wordpress plugin that allows users to send SMS messages... it is open source, so a bit of a peek into the code might help anyone who is interested in developing this further...

  3. #48
    Join Date
    Feb 2011
    Posts
    2

    Angry my countrie

    my countrie is Rwanda

  4. #49
    Join Date
    Feb 2011
    Posts
    2

    Angry my countrie

    my countrie is Rwanda

  5. #50
    Join Date
    Mar 2011
    Posts
    1

    sms gateway provider

    I donít know if it this works without an sms gateway provider. If it works for others, kindly let me know as well.

  6. #51
    Join Date
    May 2011
    Posts
    1

    Same Problem as Stephen...

    Quote Originally Posted by sepple View Post
    Sorry to revive an old thread but I have a question.

    I cannot get this script to accept my from address, rather it replaces my from address with se@p5skj233.shr.phx8.secureserver.net

    I am on a godaddy hosting plan, not sure how to fix this.

    Thanks,
    Stephen
    I have the exact same problem as Stephen. I want sales@mysite.com to be the "from" email but it is being replaced by the .shr.phx8.secureserver.net address. I too am using godaddy hosting. Many thanks to anyone who can help me with this.

  7. #52
    Join Date
    Sep 2011
    Posts
    1

    Send text message using txtimpact.com PHP library

    You can send text message to usa, canada and international destinations using txtimpact php library.

    TxtImpact SMS gateway


    Keep Texting!!

  8. #53
    Join Date
    Dec 2011
    Posts
    1
    You could always use a contact form which calls the SourceSMS API.

    PHP Code:
    <?php
    // Data for text message. This is the text message data.
    $from "FROM"// This is who the message appears to be from.
    $to "777000000"//A single number or a comma-seperated list of numbers
    // $message = "This is a test message from the PHP API script"; //160 chars or less
    $username "Your SourceSMS Username"// insert your username
    $pword "Your SourceSMS API Password"//Your developer API password
    $hash "RjK=H4kL"//Do not change
    $formCountry "44"//Change this to the appropiate country code (default UK)
    $sourceinfo "1"//Display POST info

    //extract data from the post
    //extract($_POST);

    //set POST variables
    $url 'http://sourcesms.com/api/api-function.php';
    $fields = array(
                
    'from'=>urlencode($from),
                
    'to'=>urlencode($to),
                
    'message'=>urlencode($message),
                
    'username'=>urlencode($username),
                
    'pword'=>urlencode($pword),
                
    'hash'=>urlencode($hash),
                
    'formCountry'=>urlencode($formCountry),
                
    'sourceinfo'=>urlencode($sourceinfo)
            );

    //url-*** the data for the POST
    foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
    rtrim($fields_string,'&');

    //open connection
    $ch curl_init();

    //set the url, number of POST vars, POST data
    curl_setopt($ch,CURLOPT_URL,$url);
    curl_setopt($ch,CURLOPT_POST,count($fields));
    curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);

    //execute post
    $result curl_exec($ch);

    //close connection
    curl_close($ch);

    ?>

  9. #54
    Join Date
    Sep 2005
    Posts
    1,636
    There is also one another PHP script like:
    PHP Code:
    <?php

    ########################################################
    # Login information for the SMS Gateway
    ########################################################

    $ozeki_user "admin";
    $ozeki_password "abc123";
    $ozeki_url "http://127.0.0.1:9501/api?";

    ########################################################
    # Functions used to send the SMS message
    ########################################################
    function httpRequest($url){
        
    $pattern "/http...([0-9a-zA-Z-.]*).([0-9]*).(.*)/";
        
    preg_match($pattern,$url,$args);
        
    $in "";
        
    $fp fsockopen("$args[1]"$args[2], $errno$errstr30);
        if (!
    $fp) {
           return(
    "$errstr ($errno)");
        } else {
            
    $out "GET /$args[3] HTTP/1.1\r\n";
            
    $out .= "Host: $args[1]:$args[2]\r\n";
            
    $out .= "User-agent: Ozeki PHP client\r\n";
            
    $out .= "Accept: */*\r\n";
            
    $out .= "Connection: Close\r\n\r\n";

            
    fwrite($fp$out);
            while (!
    feof($fp)) {
               
    $in.=fgets($fp128);
            }
        }
        
    fclose($fp);
        return(
    $in);
    }



    function 
    ozekiSend($phone$msg$debug=false){
          global 
    $ozeki_user,$ozeki_password,$ozeki_url;

          
    $url 'username='.$ozeki_user;
          
    $url.= '&password='.$ozeki_password;
          
    $url.= '&action=sendmessage';
          
    $url.= '&messagetype=SMS:TEXT';
          
    $url.= '&recipient='.urlencode($phone);
          
    $url.= '&messagedata='.urlencode($msg);

          
    $urltouse =  $ozeki_url.$url;
          if (
    $debug) { echo "Request: <br>$urltouse<br><br>"; }

          
    //Open the URL to send the message
          
    $response httpRequest($urltouse);
          if (
    $debug) {
               echo 
    "Response: <br><pre>".
               
    str_replace(array("<",">"),array("&lt;","&gt;"),$response).
               
    "</pre><br>"; }

          return(
    $response);
    }

    ########################################################
    # GET data from sendsms.html
    ########################################################

    $phonenum $_POST['recipient'];
    $message $_POST['message'];
    $debug true;

    ozekiSend($phonenum,$message,$debug);

    ?>
    Source: http://www.ozekisms.com/index.php?owpn=327

  10. #55
    Join Date
    Sep 2005
    Posts
    1,636

    Question

    I like to set this PHP code also inside clickatell.

    PHP Code:
    $baseurl ="http://api.clickatell.com"
    $url "$baseurl/http/sendmsg?user=$username&password=$pword&api_id=$api_id&to=$to&text=$message"
    Notice: $baseurl/http/sendmsg?
    How to set $baseurl/http/sendmsg? and all variables inside ARRAYS:
    PHP Code:

    //url-*** the data for the POST
    foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
    rtrim($fields_string,'&'); 

  11. #56
    Join Date
    Apr 2012
    Posts
    1
    My doubt: hi, i have 2 doubts. First one is how to send text message to mobile number using php and second one is how to update the result depends on our reply which is sent by mobile message.
    please reply.

  12. #57
    Join Date
    Sep 2012
    Posts
    1

    How to send sms with using php

    Hello,


    *I found out how easy it was so*send text messages using*PHP, so that I can integrate*text*messaging into my apps!

  13. #58
    Join Date
    Nov 2012
    Posts
    1

    I need a little help

    I have been working on setting up a mobile website that you can send a text from using the code provide with a little modification. Everything works like I want except a message back to the sender that the message has been set. This is the message I get.

    "Warning: Cannot modify header information - headers already sent by (output started at /home/content/92/9123492/html/dui/send_sms.php:9) in /home/content/92/9123492/html/dui/send_sms.php on line 25" ( Line 25: header ("Location: sms_success.php")

    Below is my php code:

    <?php
    $from = $_POST['from'];
    $to = $_POST['to'];
    $carrier = $_POST['carrier'];
    $message = stripslashes($_POST['message']);

    if ((empty($from)) || (empty($to)) || (empty($message))) {
    header ("Location: sms_error.php");
    }

    else if ($carrier == "verizon") {
    $formatted_number = $to."@vtext.com";
    mail("$formatted_number", "From", "$from");
    mail("$formatted_number", "I am being Arrested Call Attorney Jeremy Levy (419)243-8989", "$message");

    header ("Location: sms_success.php");
    }

    else if ($carrier == "tmobile") {
    $formatted_number = $to."@tomomail.net";
    mail("$formatted_number", "I have been Arrested Call Attorney Jeremy Levy (419)243-8989", "$message");

    header ("Location: sms_success.php");
    }

    else if ($carrier == "sprint") {
    $formatted_number = $to."@messaging.sprintpcs.com";
    mail("$formatted_number", "I have been Arrested Call Attorney Jeremy Levy (419)243-8989", "$message");

    header ("Location: sms_success.php");
    }

    else if ($carrier == "att") {
    $formatted_number = $to."@txt.att.net";
    mail("$formatted_number", "I have been Arrested Call Attorney Jeremy Levy (419)243-8989", "$message");

    header ("Location: sms_success.php");
    }

    else if ($carrier == "virgin") {
    $formatted_number = $to."@vmobl.com";
    mail("$formatted_number", "I have been Arrested Call Attorney Jeremy Levy (419)243-8989", "$message");

    header ("Location: sms_success.php");
    }
    ?>

    I have tried using
    header('Location: http://www.duitoledoattorney.com/');
    no luck
    Thanks
    Larry

  14. #59
    Join Date
    Apr 2013
    Posts
    1

    Can the followiing be done for China?

    I'm a total newb so thanks in advance for your patience.

    I've translated some of my web pages into Chinese and understand that Chinese are generally more active and proficient online with their mobile phones rather than with PCs. I also understand that Chinese mobile phones have 11 digit numbers without area codes.

    I'd also like the contents of the message to be preformatted ie. "A web page for you: [& a clickable URL?]"

    It looks like the country has 32 mobile operators.

    Is this possible? Should I even bother to undertake this daunting task?

  15. #60
    Join Date
    Jun 2013
    Posts
    1
    Do i need a sms gateway for this sir?
    I'm just a beginner and I don't know how to make things work.
    I tried to put the .html and .php codes to my xampp htdocs but nothings happened..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles