Skip to content

Instantly share code, notes, and snippets.

@gavinblair
Created March 4, 2011 20:11
Show Gist options
  • Save gavinblair/855627 to your computer and use it in GitHub Desktop.
Save gavinblair/855627 to your computer and use it in GitHub Desktop.
Minecraft Server Message command
<?php
unset($argv[0]);
$message = implode(" ", $argv);
shell_exec("curl -d '{\"name\":\"SERVER\",\"message\":\"$message\"}' http://10.0.1.104:80/up/sendmessage");
php msg.php $*
@gavinblair
Copy link
Author

Doesn't work.

./msg.sh Hello this is the ADMIN

only sends the first word, "Hello". What do?

@SeanJA
Copy link

SeanJA commented Mar 4, 2011

Yep, I would aggree with StuartClark on this one... did you try that?

@StuartClark
Copy link

Sorry I accidently deleted what I suggested.

Try ./msg.sh "Hello this is the ADMIN"
with quotes

@gavinblair
Copy link
Author

Didn't work. The problem is the embedded quotation marks in the script.

You can test it out using http://198.20.49.65:1337/up/sendmessage as the last part of the line, and visiting http://198.20.49.65:1337/ to see the result.

@SeanJA
Copy link

SeanJA commented Mar 7, 2011

They can't speak back to me though...

@SeanJA
Copy link

SeanJA commented Mar 7, 2011

Why are you using the command line rather than php's curl?

@gavinblair
Copy link
Author

Way easier, especially since I am not expecting anything back from the server. Takes a minimum of 3 lines of code to do PHP's cURL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment