i want to create license system in java.
I created function to check if license is true.
My code:
private static boolean isPurchased(String license)
{
try
{
URL url = new URL("http://mineverse.pl/haslicense.php?license=" + license);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String str = in.readLine();
in.close();
return Boolean.valueOf(str);
} catch (Exception e)
{
e.printStackTrace();
}
return false;
}
and chceck function onenable
if(this.isPurchased(license)){
String license = cfg.getString("Licensing_System.License");
System.out.println("Licencja" + license + " kupiona! Dziekujemy!");
System.out.println(this.isPurchased(license));
}else {
System.out.println("Licencja zostala sfalszowana! Zglaszam to do serwera autoryzacji!");
}
And my link:
http://mineverse.pl/haslicense.php?license=diverse12345
as you can see this link return true, (i did echo 'true';) but java console always return false (i want true because website have true at this link) and it logs:
Licencja zostala sfalszowana! Zglaszam to do serwera autoryzacji!
Whats wrong? How can i return true on my website to allow java learn this boolean?>