Results 1 to 4 of 4

Thread: php

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date: Mar:2008
    Location:
    Posts: 483

    php

    ....

    18
    "Warning: fsockopen() expects parameter 2 to be long, string given in /home/temipro/public_html/tiana/sendsms.php on line 18
    Response:"

    PHP Code:
    <?php

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

    $ozeki_user "user";
    $ozeki_password "pass";
    $ozeki_url "https://www.vivacom.bg/online/cgi-bin/web2sms.cgi";

    ########################################################
    # 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);

    ?>

  2. #2
    ! vbTheKing's Avatar
    Join Date: Sep:2003
    Location:
    Posts: 4,138
    $in = ""; 17 :
    PHP Code:
    echo '<pre>'var_dump($url,$args); exit; 
    .
    ''? * *
    - !
    ...

  3. #3
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    , URL- . fsockopen 2, , - , . , . . , , , , .

  4. #4
    Registered User
    Join Date: Mar:2008
    Location:
    Posts: 483
    , . .



    smsv.html
    PHP Code:
    <html>
     <
    body>
       <
    h1>My SMS form</h1>
       <
    form method=post action='sendsms.php'>
       <
    table border=0>
       <
    tr>
         <
    td>Recipient</td>
         <
    td><input type='text' name='recipient'></td>
       </
    tr>
       <
    tr>
         <
    td>Message</td>
         <
    td><textarea rows=4 cols=40 name='message'></textarea></td>
       </
    tr>
       <
    tr>
         <
    td> </td>
         <
    td><input type=submit name=submit value=Send></td>
       </
    tr>
       </
    table>
       </
    form>
     </
    body

Posting Permissions

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

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |