Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $arg = "http://wp.me/phhhb-ul";
- if($argv[1] != NULL)
- $arg = $argv[1];
- while(true) {
- $url = split("/",$arg);
- $ip = gethostbyname($url[2]);
- echo "Connect to: ". $url[2] ." (". $ip . ")\r\n";
- $socket=socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
- socket_connect($socket, $ip, 80);
- $the_url = "";
- for($j = 3; $j < count($url); $j++)
- $the_url = $the_url ."/". $url[$j];
- $http_req = "HEAD /". $the_url ." HTTP/1.1\r\nHost: ". $url[2] ."\r\n\r\n";
- socket_write($socket, $http_req, strlen($http_req)+1);
- $http_res_sz = socket_recv($socket, $http_res, 8196, MSG_WAITALL);
- $http_res_a = explode("\r\n", $http_res);
- for( $i = 0; $i < count($http_res_a); $i++) {
- $type = split(" ",$http_res_a[$i]);
- switch($type[0]) {
- case "HTTP/1.1":
- if($type[1] > 300 && $type[1] < 400)
- echo "Redirection to: ";
- if($type[1] == 200) {
- echo "True URL: $arg\r\n";
- exit;
- }
- continue;
- case "Location:":
- echo $type[1] ."\r\n";
- $arg = $type[1];
- }
- }
- socket_close($socket);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement