Forum Moderators: coopster & phranque

Message Too Old, No Replies

CGI PERL and PHP

How to mix both scripts

         

Maleville

5:48 pm on Jul 23, 2003 (gmt 0)

10+ Year Member



Hello.

I don't know where to post this message PHP or PERL.

I have a script in PERL and, as I don't know if it is possible in PERL, I would want to include a PHP script which mail me as soon as a fault arrives on my site.
I don't want to use "sendmail" ou "formail", just a littel script which mail me.
The result should be:

#!/usr/bin/perl --
# follow the PERL code
# Below, the PHP code
$adr_expediteur = 'error404@mydomain.net';
$to="webmaster@mydomain.net";
$sujet="ERROR 404 on the website.";
if(empty($HTTP_REFERER)) { $provenance="direct link"; } else { $provenance=$HTTP_REFERER; }
$message="\nError 404\n\nProvenance : ".$provenance.";
Page : ".$SCRIPT_URI."\nNavigateur : $HTTP_USER_AGENT\nAdress IP : [$REMOTE_ADDR\nDomain...] name: ".gethostbyaddr($REMOTE_ADDR)."\n";
@mail($to,$sujet,$message, "From: $adr_expediteur");
# End PHP code
exit;

Is it possible or is there an other way to complete this script?

Thank you for your help.

bilalak

6:17 am on Jul 24, 2003 (gmt 0)

10+ Year Member



Just put the PERL in another file and use include or require

test.php
<?
... PHP code
... PHP code
include "other.pl";
... PHP code
... PHP code
?>

Maleville

6:26 pm on Jul 24, 2003 (gmt 0)

10+ Year Member



Thank you for your answer.
It works but only with complete link (http://www.mydomain/other.cgi)