+ Reply to Thread
Results 1 to 5 of 5

Thread: Perl Problem

  1. #1
    Junior Member
    Join Date
    Sep 2001
    Posts
    2

    Perl Problem

    I have this script which was working fine.It receives calls from a wap system in order to search a file to get a specific logo and send it to mobile. I do not think there is a syntax problem but I just cannot figure out what is wrong. Appreciate who will help me.

    The script is :
    #!/usr/local/bin/perl
    print "Content-type: text/html\n\n";
    print " ";
    use CGI;
    use IO::Socket;

    $cgi = new CGI;



    $pass="UID=aboughal&PW=2110490&M=1";




    $sock = IO::Socket::INET->new(
    Proto => "tcp", PeerAddr => "clients.sms-wap.com", PeerPort => 80
    );

    if (defined($sock)) {

    # Connection ok
    #
    $sock->autoflush(1);

    # Construct the query string to send and determine its length
    # UID, PW = username and password (required)
    # N = list of comma-separated recipient numbers (required)
    # M = text message (required)
    #

    $len = length($pass);

    # Send request
    #
    $sock->print("POST /cgi/accparam.cgi HTTP/1.0\n");
    $sock->print("Host: clients.sms-wap.com\n");
    $sock->print("Content-type: application/x-www-form-urlencoded\n");
    $sock->print("Content-length: $len\n\n");
    $sock->print("$pass\n");

    # Get response (2-digit numeric code)
    # 01 = OK, message scheduled for delivery
    # 97 = syntax error or missing parameters
    # 98 = insufficient account balance
    # 99 = other error
    #

    while ($_ = <$sock>) {
    if (/^(\d+)/) { $results = $1; last; }
    }

    $sock->close;
    @result = split (/ /,$_);
    &build_record_page;

    }
    else {
    # Connection error
    print $cgi->header."Connection failed!";
    }


    sub build_record_page {
    my (%record) = @_;
    my ($val) = "";
    my ($html) = qq~<TABLE border=1 bgcolor="#FFFFFF" cellspacing=0 cellpadding=4>
    <TR bgcolor="#CAF51D">
    <TD colspan=2><CENTER><font size=-1>------ Abou Ghali Group Account Balance -------</CENTER></TD>
    </TR>~;

    $html .= qq~<TR bgcolor="#DDDDDD"><TD><CENTER><FONT SIZE=-3> Total Messages Remaining </CENTER> </TD>~;

    $html .= qq~<TD bgcolor="#CAF51D"><CENTER><FONT SIZE=-3><b> $result[1] <b></CENTER></TD>~;

    $html .= qq~</TR>~;
    $html .= "</TABLE>";

    print $html;
    }


    exit 0;

  2. #2
    Banned qball's Avatar
    Join Date
    Oct 1999
    Location
    Rockaway, NJ 07866
    Posts
    1,730
    I have this script which was working fine.
    Then, what is the problem?

  3. #3
    Junior Member
    Join Date
    Sep 2001
    Posts
    2

    That is the Questions



    I am really confused about that . I upload the script to the site
    and tried many many times to make it run . It wont! although I
    did not find any syntax Err I cannot fix the problem for a long
    time . I need your help .:o

  4. #4
    Banned qball's Avatar
    Join Date
    Oct 1999
    Location
    Rockaway, NJ 07866
    Posts
    1,730
    so am I, and honestly, you really don't need my help.

    So the script doesn't work fine...

    Anyway, debug, debug, debug.

    Find out (at the very least):

    1. who/what/how script is run.
    1a. Script called correctly.
    2. Script invoked.
    3. Line where script fails.
    4. what happens wif who/what/how script is run.

    Should be pretty easy after that...

  5. #5
    Member
    Join Date
    Feb 2000
    Location
    Strongsville, Ohio, USA
    Posts
    265
    do you get any output when you run the script from command line? try perl -w script.pl (or .cgi, whichever)

    i dont know much about cgi perl, but it may be a simple mistake, who knows
    -Rob Jerina
    System Specs:
    AMD Tbird 1.2ghz 200mhz FSB
    OCZ PC150 256mb SDRAM
    IBM DeskStar 60GXP 60gb 7200rpm
    Hercules ProphetII MX 32MB Dual-Display Video
    Creative SBLive X-Gamer

Bookmarks

Posting Permissions

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







New Security Features Planned for Firefox 4
Another Laptop Theft Exposes 21K Patients' Data
Oracle Hits to Road to Pitch Data Center Plans
Microsoft Preps Array of Windows Patches
Microsoft Nears IE9 Beta With Final Preview
Simplified Analytics Improve CRM, BI Tools
Android Passes RIM as Top Mobile OS in 2Q
VMware Updates Hyperic System Management
File Monitoring Key to Enterprise Security
LinkedIn Snaps Up SaaS Player mSpoke