Jump to content

i-sultan

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

i-sultan's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi all I am sorry but solution may be interesting for someone... I solved this problem almost 2 weeks ago but forgot a bit so now my solution is just use function gethostbyname() to get IP address of host and then use get_headers() function... 1#!/usr/bin/php -q 2 <?php 3 $links = array( 4 'www.kg', 5 'www.inkar.info', 6 'www.sdpk.info', 7 'www.sdpk.kg', 8 'www.google.com', 9 'www.google.tre' 10 ); 11 12 for ( $i = 0; $i < count($links); $i++ ) { 13 $ip = gethostbyname($links[$i]); 14 15 $valid_link = 'http://'.$ip; 16 17 if ( preg_match('/^\d+/', $ip) == 0 ) { 18 print "Unable to resolve address...\n"; 19 20 continue; 21 } 22 23 printf("Link:%s; IP:%s\n", $links[$i], $ip); 24 print_r(get_headers($valid_link)); 25 } thanks for all !!!
  2. I see such response ... ... ... ====================LINK:www.spdk.info======================= Warning: get_headers(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/sultan/Http/monitor2/worker.php on line 66 Call Stack: 0.0002 105168 1. {main}() /home/sultan/Http/monitor2/monitor.php:0 0.0253 214960 2. include('/home/sultan/Http/monitor2/worker.php') /home/sultan/Http/monitor2/monitor.php:9 20.7031 233680 3. get_headers() /home/sultan/Http/monitor2/worker.php:66 Warning: get_headers(http://www.spdk.info): failed to open stream: No such file or directory in /home/sultan/Http/monitor2/worker.php on line 66 Call Stack: 0.0002 105168 1. {main}() /home/sultan/Http/monitor2/monitor.php:0 0.0253 214960 2. include('/home/sultan/Http/monitor2/worker.php') /home/sultan/Http/monitor2/monitor.php:9 20.7031 233680 3. get_headers() /home/sultan/Http/monitor2/worker.php:66 ====================LINK:www.sdpk.kg======================= Array ( [0] => HTTP/1.1 301 Moved Permanently [1] => Date: Sun, 09 Aug 2009 10:03:21 GMT [2] => Server: Apache [3] => Location: /ru/ [4] => Content-Length: 0 [5] => Content-Type: text/html [6] => HTTP/1.1 200 OK [7] => Date: Sun, 09 Aug 2009 10:03:21 GMT [8] => Server: Apache [9] => Set-Cookie: PHPSESSID=fad3fe28142ca20b8a1b3644a65bec9b; path=/ [10] => Expires: Thu, 19 Nov 1981 08:52:00 GMT [11] => Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 [12] => Pragma: no-cache [13] => Connection: close [14] => Content-Type: text/html )
  3. try these links please http://www.kloop.kg http://www.dw-world.de http://blogs.mail.ru http://www.internews.fr http://http://www.spdk.kg http://www.spdk.info http://www.sdpk.kg http://www.shailoo.gov.kg
  4. Invalid - com-foo-bar, but this link is not invalid http://sdpk.info it is in an array... When this link is represented as array element i get warning, but if i do so php -r "var_dump(get_headers('http://sdpk.info'));" it works well...
  5. seems it tries to call internal function which fails in turn... but if i call get_headers(DROPPED_URL) it works, I am confused ...
  6. A little detail, URL on what get_headers() function fires warning are within long array, and when I call get_headers(...) just once on dropped URLs it works but within a loop it does not ...
  7. I am calling it with parameters (even clarified urls) Code
  8. Hi all. I have a small problem with get_headers() function, sometimes it does not work adequate e.g. getting headers of working web resource it fires warning like this Warning: get_headers(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/sultan/Http/monitor2/worker.php on line 66 Call Stack: 0.0002 105168 1. {main}() /home/sultan/Http/monitor2/monitor.php:0 0.0270 276416 2. include('/home/sultan/Http/monitor2/worker.php') /home/sultan/Http/monitor2/monitor.php:9 358.8022 311040 3. get_headers() /home/sultan/Http/monitor2/worker.php:66 is there any issues ? Is it possible to avoid situations like this ? PLEASE HELP SOON Thank in advance
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.