One, through the Curl function
Copy Code code as follows:
$post _data = Array ();
$post _data[' clientname '] = "test08";
$post _data[' clientpasswd '] = "test08";
$post _data[' submit '] = "submit";
$url = ' http://xxx.xxx.xxx.xx/xx/xxx/top.php ';
$o = "";
foreach ($post _data as $k => $v)
{
$o. = "$k =". UrlEncode ($v). & ";
}
$post _data=substr ($o, 0,-1);
$ch = Curl_init ();
curl_setopt ($ch, Curlopt_post, 1);
curl_setopt ($ch, Curlopt_header, 0);
curl_setopt ($ch, Curlopt_url, $url);
To support cookies
curl_setopt ($ch, Curlopt_cookiejar, ' cookie.txt ');
curl_setopt ($ch, Curlopt_postfields, $post _data);
$result = curl_exec ($ch);
ii. Adoption of Fsockopen
Copy Code code as follows:
$URL = ' http://xxx.xxx.xxx.xx/xx/xxx/top.php ';
$post _data[' clientname '] = "test08";
$post _data[' clientpasswd '] = "test08";
$post _data[' submit '] = "ログイン";
$referrer = "";
Parsing the given URL
$URL _info=parse_url ($URL);
Building referrer
if ($referrer = = "")//if not given use this script as referrer
$referrer =<pre class=php name= "code" >{1}</PRE><BR>
server["Script_uri"]; Making string from $dataforeach ($post _data as $key => $value) $values []= "$key =". UrlEncode ($value); $data _string=implode ("&", $values)//Find out which the port is needed-if to given use standard (=80) if (!isset ($URL _inf o["Port"]) $URL _info["Port"]=80;//
Building post-request: $request. = "POST". $URL _info["path"]. " Http/1.1\n "$request. =" Host: ". $URL _info[" host "]." \ n "; $request. =" Referer: $referrer \ n "; $request. =" content-type:application/x-www-form-urlencoded\n "; $request. =" Content-length: ". strlen ($data _string)." \ n "; $request. =" Connection:
Close\n "$request. =" \ n "; $request. = $data _string." \ n "; $fp = Fsockopen ($URL _info[" host "], $URL _info[" Port "), Fputs ($fp, $request), while (!feof ($fp)) {$result. = fgets ($ FP, 128);} Fclose ($FP);
<PRE></PRE>
<P><BR>
</P>
<p>snoopy Class (2) <BR>
Sourceforge.net/projects/snoopy/</p>
<P>http://www.redalt.com/xref/trunk/nav.htm?wp-includes/class-snoopy.php.htm</P>
<p>http Class (1,2) </P>
<P>http://www.phpclasses.org/browse/download/1/file/5/name/http.php</P>
<p>pear http_request</p>
<P>http://pear.php.net/package/HTTP_Request</P>
<p class=akpc_pop>popularity:70%</p>
<P> </P>