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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.