Hi, I was setting up a website for my new server, and I wanted to add minecraft username verification, kind of like enjin. I want it so that people are redirected to minecraft.net, and if they login successfully, then they will be registered to my site. Anyone know how to do that using PHP? Thanks in advance...
Create an account or sign in to comment.
8
1
Thanks SOOOOOO much for this.
1
<form action="https://login.minecraft.net" method="post">
<div id="login_area">
Username / Email:
<input type="text" id="user" name="user" value="">
<br>
Password:
<input type="password" id="password" name="password" value="">
<input type="hidden" id="version" name="version" value="13">
</div>
<div id="login_submit">
<input type="submit" class="button" value="Log In">
</div>
</form>
When you submit this, it will return a set of strings, delimited by colons (":"). An explanation on those:
wiki1. current version of the game files (not the launcher itself). This is a unix timestamp which the launcher compares to the ~/.minecraft/bin/version file.
2. Previously contained a download ticket for requesting new versions of minecraft.jar from the server. Now contains only "deprecated".
3. case-correct username.
4. sessionId - a unique ID for your current session.
5. UID - currently unused, introduced near August 8th, 2012. Grum says this is the unique ID for the user, potentially for changing Minecraft names in future.
If you don't get that string returned, then:
wikiIf the request is missing a parameter, the server will return "Bad response". If the login information is incorrect, the server will return "Bad login". If the login information is correct but the account isn't premium, the server will return "User not premium". If your minecraft.net account has been migrated to a Mojang account but you're logging in with your minecraft.net username the server will return "Acount migrated, use e-mail".
1
Hi, rogue thaks for the help, is there any way u can make a rough example, it would help a lot.
1
I don't think that'll be able to work unless you get special code from Mojang. That link will only help if you're interested in manually checking if someone is premium or not
1
I don't think you can do this because Minecraft doesn't have an open API. Would be sort of hard unless you contact Mojang yourself.
1
So enjin actually contacted minecraft so that they can setup verification? Also i founbd this link:
https://minecraft.net/haspaid.jsp?user={usename of player}
this basically states if user is premium. Any idea on how to scrape the true or false with php?
https://minecraft.net/haspaid.jsp?user={usename of player}
this basically states if user is premium. Any idea on how to scrape the true or false with php?
1
You wouldn't be able to verify they are the owner of the account though. And they probably won't want to give you the info anyhow.
Details for logging in with php: http://wiki.vg/Authentication#Login
A good lib for it: http://requests.ryanmccue.info/
Details for logging in with php: http://wiki.vg/Authentication#Login
A good lib for it: http://requests.ryanmccue.info/
1
Bump!