PHP This code is echo error message even if its correct!
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: This code is echo error message even if its correct!

  1. #1
    Join Date
    Feb 2012
    Posts
    17

    This code is echo error message even if its correct!

    The problem with this code is either the sending SMS has been sent successfully or NOT successfully will echo for me the same message.




    Code:
    <?php
    $baseurl = "XXXX";
    $username = urlencode("XXXX");
    $password = urlencode("XXXX");
    $mobile = urlencode("6".$_POST['mobile']);
    $message = urlencode($_POST['message']);
    $sender = urlencode($_POST['sender']);
    $type = urlencode("1");
    
    $url = $baseurl."/websmsapi/ISendSMS.aspx?username=".$username."&password=".$password.
    "&mobile=".$mobile."&message=".$message.
    "&sender=".$sender."&type=".$type;
    
    
    
    // do sendmsg call
    $ret = fetchURL($url);
    $send = split(":",$ret);
    
    if ($send[0] == "ID") {
    // Message was submitted to gateway successfully
    echo ($ret);
    echo "Your Message has been sent successfully man!";
    
    }
    else {
    // There was an ERROR
    echo ($ret);
    echo "OMG. You made an Error man!. Go back and check your staff!!";
    }
    
    
    ?>
    I am sure the problem in IF ELSE but I could not solve it.

    Any help please?
    Last edited by general07z; October 11th, 2012 at 02:23 AM.

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,870

    Re: This code is echo error message even if its correct!

    There's no such PHP function as fetchURL().

    Note: split() is a deprecated function. You should be using explode() instead.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center