Jump to content

Shell_Exec() with gammu


arturo322

Recommended Posts

Hi im Art,

Im trying to make use of Shell_exec() function to execute gammu(smsgateway for linux<CLI>) to text a message using my php page.

 

This is my actual code:

 

<html>

<form method="POST">

Message: <textarea name=Message></textarea>

Number: <input type=Text name=Number>

<Input type=Submit name=Send value=Send>

</form>

</html>

 

<?php

extract($_POST);

if (isset($Send)){

$output = shell_exec("pwd");

echo $output."<br>";

$cmd="gammu --identify";

echo $cmd."<br>";

$output = shell_exec($cmd);

echo $output;

$cmd="echo '".$Message."'|gammu sendsms TEXT ".$Number;

echo $cmd."<br>";

$output = shell_exec($cmd);

echo $output;

}

?>

 

 

But this is the error:

/opt/lampp/htdocs

gammu --identify

Error opening device, you don't have permissions.

echo 'Hi There'|gammu sendsms TEXT +639270000000

Error opening device, you don't have permissions.

 

 

PS: It works well if just issue the command

echo 'Hi There'|gammu sendsms TEXT +639270000000

on my terminal

but i dont know why it doesnt work for php, and another thing, i wasnt using any

sudo commands on shell i just type the command directly, hope someone can help me out thanks

Link to comment
https://forums.phpfreaks.com/topic/223969-shell_exec-with-gammu/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.