how to run perl in php

Started on the old forum in December 2011 · view the original in the archive · old links redirect here

1 reply · 485 views · started 14 years ago · 1 min read

2 participants
piacthtiye Newbie · 1 posts #1

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)VALUES ('".$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>
wap2k Developer · 168 posts #2

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

For Example:

<?php

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

?>

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close