|
|
PHP
Tutorial
3.Finding
the IP Address of the user
----------------------------------------------------
The $_SERVER is a global variable array , the
REMOTE_ADDR key of this array holds the IP address of the host from
where the request is made.
Thereby giving the IP address of the host which makes
the request
|
|
<?php
$ip = $_SERVER['REMOTE_ADDR'];
echo "Your IP address is as follows: " . $ip;
?>
***************************************************************************************
4.
Using socket functions to read and write from web sites
--------------------------------------------------------------------------------------
Content can be written or read to or from a web site
by opening the approriate port. The fsockopen() function
takes the ip address or the web site address and the port on which the
respective has to be opened and opens a connection. Then,the
header containing Host,Connection type and GET command is written using
fwrite() function into the opened site
The fsockopen() method can take IP address also
instead of domain name as its first argument.The error string option
gives the verbose of error whereas the error number gives the
corresponding error number of the error that has occured.
|
Details about SCJP 1.2
Exam number :
CX-310-025
Prerequisites : None
Exam type :
Multiple choice and short answer
Questions :
59
Pass score :
61% (36 of 59 questions)
Time limit :
120 minutes |
|
|