simple net send

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Regit
Forum Newbie
Posts: 11
Joined: Tue Oct 10, 2006 7:36 am
Location: Here, there, everywhere

simple net send

Post by Regit »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Im having frustrations... i cannot get php to do a net send, how is this done? or what am I doing wrong?

Code: Select all

<?php
	$output = shell_exec("net send myipaddress test");

	print $output;

?>
I did the above, and nothing was sent. I know this is simple but im not sure why its not working...


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
buttie
Forum Newbie
Posts: 2
Joined: Tue Dec 19, 2006 12:56 pm

Post by buttie »

what result do you get when you try this command (the one called by shell_exec) directly on the command line?

be aware that shell_exec does not work (is disabled) when php is in safe_mode
User avatar
Regit
Forum Newbie
Posts: 11
Joined: Tue Oct 10, 2006 7:36 am
Location: Here, there, everywhere

Post by Regit »

I am getting this error

Fatal error: Call to undefined function shell_exe() in c:\Inetpub\wwwroot\testing fun\netsend.php on line 2

is there something I need to add to the php.ini file? and i am not running php in safe mode
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

Um... no, but you do need to call the correct function... shell_exec()
User avatar
Regit
Forum Newbie
Posts: 11
Joined: Tue Oct 10, 2006 7:36 am
Location: Here, there, everywhere

Post by Regit »

:) ok i fixed the typo in the code but now it gives me

Code: Select all

Warning: shell_exec() [function.shell-exec]: Unable to execute 'net send tn-sys-386 test' in c:\Inetpub\wwwroot\testing fun\netsend.php on line 2
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

Does it work on the command line? if so, copy it exactly into your php document.

Also, remember: php does not necessarily have the same privileges you do, you might need to su to another user. look up the "su - -c" command in linux.

Cheers,
Kieran
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

is 'net send' not windows specific?
Post Reply