Hello, I have a problem with code -get Internal Server Error 500 and have no idea why script not work.
#!/usr/bin/perl $searchstring = "alcatel"; $email = "mymail\@domain.com"; $localfile = "/home/www/mp3catalog/search.txt"; use WWW::Search; $searchobject = new WWW::Search('Ebay'); $query = WWW::Search::escape_query($searchstring); $searchobject->native_query($query); # *** put results into two arrays *** $a = 0; while ( $resultobject = $searchobject->next_result() ) { $a++; ( $itemnumber[$a] ) = ( $resultobject->url =~ m!item=(\d+)! ); $title[$a] = $resultobject->title; } # *** eliminate entries already in file *** open( INFILE, "$localfile" ); while ( $line = <INFILE> ) { for ( $b = $a ; $b >= 1 ; $b-- ) { if ( $line =~ $itemnumber[$b] ) { splice @itemnumber, $b, 1; splice @title, $b, 1; } } } close(INFILE); $a = @itemnumber - 1; if ( $a == 0 ) { exit; } # *** save any remaining new entries to file *** open( OUTFILE, ">>$localfile" ); for ( $b = 1 ; $b <= $a ; $b++ ) { print OUTFILE "$itemnumber[$b]\n"; } close(OUTFILE); # *** send email with new entries found *** open( MAIL, "|/usr/sbin/sendmail -t" ); print MAIL "To: $email\n"; print MAIL "From: $email\n"; print MAIL "Subject: New $searchstring items found\n\n"; print MAIL "The following new items have been listed on eBay:\n"; for ( $b = 1 ; $b <= $a ; $b++ ) { print MAIL "$title[$b]\n"; print MAIL "http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=$it +emnumber[$b]\n\n"; } close(MAIL);
Server logs can no help much -dont know
[Thu May 26 20:31:20 2005] [error] [client 162.85.112.14] Premature en +d of script headers: /home/users/mp3catalog/www/mp3catalog.superihost +.com/cgi-bin/robot.pl [Thu May 26 20:35:42 2005] [error] [18321] VDB# exec failed for '/home +/users/mp3catalog/www/mp3catalog.superihost.com/cgi-bin/robot.pl' [11 +] [Thu May 26 20:35:42 2005] [error] [client 162.85.112.14] Premature en +d of script headers: /home/users/mp3catalog/www/mp3catalog.superihost +.com/cgi-bin/robot.pl [Thu May 26 20:35:44 2005] [error] [18331] VDB# exec failed for '/home +/users/mp3catalog/www/mp3catalog.superihost.com/cgi-bin/robot.pl' [11 +] [Thu May 26 20:35:44 2005] [error] [client 162.85.112.14] Premature en +d of script headers: /home/users/mp3catalog/www/mp3catalog.superihost +.com/cgi-bin/robot.pl [Thu May 26 20:35:45 2005] [error] [18337] VDB# exec failed for '/home +/users/mp3catalog/www/mp3catalog.superihost.com/cgi-bin/robot.pl' [11 +] [Thu May 26 20:35:45 2005] [error] [client 162.85.112.14] Premature en +d of script headers: /home/users/mp3catalog/www/mp3catalog.superihost +.com/cgi-bin/robot.pl [Thu May 26 20:35:47 2005] [error] [18353] VDB# exec failed for '/home +/users/mp3catalog/www/mp3catalog.superihost.com/cgi-bin/robot.pl' [11 +] [Thu May 26 20:35:47 2005] [error] [client 162.85.112.14] Premature en +d of script headers: /home/users/mp3catalog/www/mp3catalog.superihost +.com/cgi-bin/robot.pl [Thu May 26 20:35:48 2005] [error] [18366] VDB# exec failed for '/home +/users/mp3catalog/www/mp3catalog.superihost.com/cgi-bin/robot.pl' [11 +] [Thu May 26 20:35:48 2005] [error] [client 162.85.112.14] Premature en +d of script headers: /home/users/mp3catalog/www/mp3catalog.superihost +.com/cgi-bin/robot.pl [Thu May 26 20:35:49 2005] [error] [18370] VDB# exec failed for '/home +/users/mp3catalog/www/mp3catalog.superihost.com/cgi-bin/robot.pl' [11 +] [Thu May 26 20:35:49 2005] [error] [client 162.85.112.14] Premature en +d of script headers: /home/users/mp3catalog/www/mp3catalog.superihost +.com/cgi-bin/robot.pl [Thu May 26 20:35:51 2005] [error] [18377] VDB# exec failed for '/home +/users/mp3catalog/www/mp3catalog.superihost.com/cgi-bin/robot.pl' [11 +] [Thu May 26 20:35:51 2005] [error] [client 162.85.112.14] Premature en +d of script headers: /home/users/mp3catalog/www/mp3catalog.superihost +.com/cgi-bin/robot.pl

Janitored by holli - added readmore tags

Retitled by holli from 'SCRIPT REFUSE TO WORK'.


In reply to 'Premature end of script' errors running script as CGI by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.