Website > Server communications

Discussion in 'Plugin Development' started by DrAgonmoray, Sep 10, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    DrAgonmoray

    Hi, I'm wondering if it's possible to make my webserver (specifically a php script) communicate with a minecraft server via a simple HTTP request, such as POST.
    I know I can post data to a webserver from a minecraft server, but can i do the opposite? :D
     
  2. Basically you would need a plugin that opens a ServerSocket which waits for incoming requests. Port 80 for http-requests would be helpful, but since lots of gameserver providers have that blocked you should provide an alternative (dunno if PHP can create requests to another port).
    Use google to find detailed tutorials about Java server programming.

    But if the PHP script frequently needs the data, it would probably be better to let your plugin push the data to a database (mySQL) and let your PHP script communicate with that.
     
  3. Offline

    DrAgonmoray

    seems like a lot of work.
    I've been able to send http requests to a php script and get a response back without forwarding any ports.

    All I need to do is maybe a few times a day at most, have a php script send a little string to the bukkit server, and then have my plugin interpret the string and do operations accordingly.

    I'm trying to make it so when someone donates on a website, php processes the paypal IPN, then send info to the plugin and applies permissions accordingly.

    I suppose I can do it like this instead:
    Php processes the paypal IPN, and adds info to a database.
    Donor then types a command (like /redeem or something) and the plugin will send an http response to a php script that fetches info from a database and responds to the plugin with data that the plugin processes.

    yeah that's what I'll do.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 19, 2016
  4. Offline

    o0AzzA0o

    php can simply interface with ssh shell session if you have linux hosted server perhaps you could look at that as a solution? since you could gain access to console that way

    would it not make sence to have mysql stored permissions? and just have a php script update players group via mysql query?

    i think there are already quite a few forum/permissions bridges floating about..

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 19, 2016
  5. Offline

    DrAgonmoray

    That was my original thought, however the target permissions plugin doesn't support MySQL, and PermissionsEX as unpolished imo.
     
  6. Offline

    o0AzzA0o

    yes i agree i use PermissionsBukkit and looking at PermissionsEX it is a little over complicated so i guess there is a requirement for a plugin that could adjust permissions without the need for forum bridge + mysql permissions system.
     
  7. Offline

    codename_B

    The ONE issue now with bPermissions and SQL is getting permissions to update on the server - as they as stored in a cache (HashMap<String, ArrayList<String>>) to make getting/setting faster - this would conflict with any changes on the sql database manually (and as such I may remove this - I will have to look into performance issues involved with such a thing)

    EDIT: you're not losing too much apart from when a player is chatting - in which case the hashmap becomes necessary because of the frequency of the event... I mean it's easy enough to /p reload (clearing the cache) but the question is how do you get the server to do that?
     
  8. Offline

    DrAgonmoray

    Ah, I see.
     
  9. Offline

    codename_B

    I could make it a config option for you? :) (or even another option sql, and sql_nocache)
     
  10. Offline

    DrAgonmoray

    I like caches though. :(
     
  11. Offline

    codename_B

    On a side note: I have a nice library for writing to the server from a php script and handling it plugin-side (if you'd be interested)
     
  12. Offline

    DrAgonmoray

    I would've liked this a few hours ago lol, but I've decided to use a different approach. >.<
    I suppose I could change approaches again. Yeah, I'd like your library please. lol. :)

    Lol I finished the hard part of the donation system today: the web backend. You select a donation package, type in your IGN, confirm your IGN, then accept the terms agreement, then you get sent to paypal, then paypal IPN magic logs the donation to my database, and then gives your "account" "credits" inside my database.
    Phew.

    I guess I have to go for today. :|
    Tomorrow I'll make the plugin interface. I'll make the plugin send http requests to a php script that will do database interactions and return appropriate results back. I'm gonna go ahead and make a list of commands and features to add, so I don't forget tomorrow:
    • /credits - Displays how many credits you have
    • /credits redeem [item] - Use the credits on [item]
    • /credits list - List the things you can buy with credits
    • /credits give [player] [amount] - Give player amount of your credits. player must be online
    • /credits help - Display info and help about how to use the system

    I really don't care if any of you care what I'm saying here. I talk just because I like talking. And this serves as a good place to take notes as well as share information.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 19, 2016
  13. Offline

    NoLiver92

    I know this is alot later on but i am trying to send information to my server from php, would it be possible to use your library (if its available)?
     
  14. Offline

    metalhedd

Thread Status:
Not open for further replies.

Share This Page