Since both languages are used, we have to compare them. Let's first look at JAVA Implementation and then PHP, of course, there are many implementation methods, especially JAVA, for the implementation of the same function is definitely much more than PHP, this is undoubtedly!
JAVA Implementation Method 1:
Package com. jiucool. www. struts. action;
Import java. io. BufferedReader;
Import java. io. IOException;
Import java. io. InputStreamReader;
Import java.net. MalformedURLException;
Import java.net. URL;
Import java.net. URLConnection;
Public class doget_http_request {
Public String doget_http_request (){
StringBuffer readOneLineBuff = new StringBuffer ();
String content = "";
Try {
URL url = new URL ("http://www.jiucool.com/sendemail.php? Key = j0r53nmbbd78x7m1 "+" & activatecode = 2QyiF0SXXTq8 ");
URLConnection conn = url. openConnection ();
BufferedReader reader = new BufferedReader (new InputStreamReader (conn. getInputStream ()));
String line = "";
While (line = reader. readLine ())! = Null ){
ReadOneLineBuff. append (line );
}
Content = readOneLineBuff. toString ();
Reader. close ();
} Catch (MalformedURLException e ){
E. printStackTrace ();
} Catch (IOException e2 ){
E2.printStackTrace ();
}
Return content;
}
}
For PHP implementation, it is easy to skip the building and check the Code:
<? PhpEcho File_get_contents("Http://www.jiucool.com/sendemail.php? Key = j0r53nmbbd78x7m1 & activatecode = 2QyiF0SXXTq8");?>
PHP is too simple! However, the weak PHP language is a bit unaccustomed. variables can be used without being declared. It is too rigorous!Aspx ">