how to run perl in php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    how to run perl in php

    Hi, i was given a project in php which is to call the perl script on it.The main function is to send an sms using php, but of course it will pass thru perl to call the command.
    below is my code send.php:
    Not sure if exec() is enough to open the perl script websms_delivery.pl or i have to add some more codes to make it work.
    I would really appreciate it if someone will help me solve my problem for almost 2 weeks now
    Thanks in advance

    <?php
    $atl=$_POST['username'];
    $message=$_POST['limitedtextarea'];
    $to=$_POST['contacts'];
    $from=$_POST['senderid'];
    //$password=$_POST['password'];


    mysql_connect("192.168.78.15", "root", "") or die(mysql_error());
    mysql_select_db("ebs") or die(mysql_error());

    $result = mysql_query("SELECT ID,atl FROM sms_info where atl='".$atl."'");

    while($row = mysql_fetch_assoc($result)){

    //$display=$row['displayname'];
    //$day=date('l');
    //$date=date('F j, Y');
    //$time=date('g:i:s a');
    $id=$row['ID']; }
    $DATE=date('Y-m-d g:i:s A');

    $query= "INSERT INTO sms_contents (ID,atl,sender,message,recipient_no,date_sent)VALU ES ('".$id."','".$atl."','".$from."','".$message."',' ".$to."','".$DATE."')";

    mysql_query($query) or die ('Error Updating database');

    exec("c:/usr/bin/perl.exe websms_delivery.pl \"".$to."\" \"".$message."\" \"". $from."\" \"+".$from."\" ");

    ?>
    <script type="text/javascript">
    alert('Message Sent!');
    //window.close('send.php');
    window.open('compose.php?username=<?php echo $atl; ?>','_parent');

    </script>

    #2
    See if the exec is doing anything at all look at the output.


    For Example:

    PHP Code:
    <?php

    exec
    ("cmd.exe",$output_array);
    print_r($output_array);

    ?>

    Comment

    Working...
    X