<?phpfunction posttohost($url, $data) { $url = parse_url($url); if (!$url) return "couldn't parse url"; if (!isset($url['port'])) { $url['port'] = ""; } if (!isset($url['query'])) { $url['query'] = ""; } $encoded = ""; while (list($k,$v) = each($data)) { $encoded .= ($encoded ? "&" : ""); $encoded .= rawurlencode($k)."=".rawurlencode($v); } $fp = fsockopen($url['host'], $url['port'] ? $url['port'] : 80); if (!$fp) return "Failed to open socket to $url[host]"; fputs($fp, sprintf("POST %s%s%s HTTP/1.0\n", $url['path'], $url['query'] ? "?" : "", $url['query']));# fputs($fp, "Host: $url[host]\n"); fputs($fp, "User-Agent: Mozilla/4.0 (compatible; MSIE5.0; Windows NT 5.0)\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\n"); fputs($fp, "Accept: text/html\n"); fputs($fp, "Content-length: " . strlen($encoded) . "\n"); fputs($fp, "Connection: close\n\n"); fputs($fp, "$encoded\n"); $line = fgets($fp,1024); if (!eregi("^HTTP/1\.. 200", $line)) return; $results = ""; $inheader = 1; while(!feof($fp)) { $line = fgets($fp,1024); if ($inheader && ($line == "\n" || $line == "\r\n")) { $inheader = 0; } elseif (!$inheader) { $results .= $line; } } fclose($fp); return $results;}function gettohost($url) { $url = parse_url($url); if (!$url) return "couldn't parse url"; if (!isset($url['port'])) { $url['port'] = ""; } if (!isset($url['query'])) { $url['query'] = ""; } $fp = fsockopen($url['host'], $url['port'] ? $url['port'] : 80); if (!$fp) return "Failed to open socket to $url[host]"; fputs($fp, sprintf("GET %s%s%s HTTP/1.0\n", $url['path'], $url['query'] ? "?" : "", $url['query']));# fputs($fp, "Host: $url[host]\n"); fputs($fp, "User-Agent: Mozilla/4.0 (compatible; MSIE5.0; Windows NT 5.0)\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\n"); fputs($fp, "Accept: text/html\n");# fputs($fp, "Content-length: " . strlen($encoded) . "\n"); fputs($fp, "Connection: close\n\n"); $line = fgets($fp,1024); if (!eregi("^HTTP/1\.. 200", $line)) return; $results = ""; $inheader = 1; while(!feof($fp)) { $line = fgets($fp,1024); if ($inheader && ($line == "\n" || $line == "\r\n")) { $inheader = 0; } elseif (!$inheader) { $results .= $line; } } fclose($fp); return $results;}$id = "999999999";$password = "1234";$ip = "172.24.5.28";$url = "[url]http://172.31.130.251/servlet/scpservlet.UserDataReqLoginServlet[/url]";#$url = "[url]http://localhost/test2.php?id=1[/url]";$data = array( 'id' => $id, 'inputpassword' => '', 'servicetype' => '201+', 'ip' => $ip, 'password' => $password, 'languagetype' => '0', 'operatingSystem' => '1', 'httpIp' => '211.95.166.57', 'RadiusVision' => '1', 'Domain' => 'uestc' );$results = posttohost($url, $data);echo $results;$url="[url]http://172.31.130.251/ClientProcess.jspMsgType=100&ISNNO=1000&LocalIP=$ip&UserName=$id&olduserip=$ip&httpIp=211.95.166.57&isPNP=False[/url]";$results = gettohost($url);echo $results;?>
下面是引用rob于2005-06-14 19:03发表的:o?在win下有没有这样的应用啊?
下面是引用owen于2005-06-16 17:42发表的:关键是fputs($fp, "User-Agent: Mozilla/4.0 (compatible; MSIE5.0; Windows NT 5.0)n");吧
下面是引用rob于2005-06-17 11:34发表的:对了你这个程序在win下能用不?我试试不行啊
下面是引用liux0229于2005-06-22 01:32发表的:呵呵,我自己用的版本早就用的是刷新而不是重新登录了。很长时间不在rx上网了,哪天有空的时候把新版本放上来。曾经考虑过用xui做成firefox/mozilla插件,可惜实在没有时间学xui。而且我个人认为,只要能够在Linux下面上网就可以了,功能太复杂不是太有意义。。。xui是个好东西阿,不知道谁有所研究?