Hoe een pagina redict detecteren
Ik zou graag weten hoe je kan weten met php als je een pagina hebt naar waar hij jou rederict,
Want als ik voorbeeld deze pagina na toegaa:
http://www.google.be/search?hl=nl&q=test&btnI=Ik+doe+een+gok
Zal hij in je browser naar het eerste google resultaat gaan, maar met php zal hij zeggen:
Warning: get_headers(http://www.google.be/search?hl=nl&q=test&btnI=Ik+doe+een+gok) [function.get-headers]: failed to open stream: HTTP request failed! „îkî|8‘|ÿÿÿÿ2‘|«‘|ë‘|:%|òk in c:\Server\public_html\test.php on line 4
Naar waar stuurde hij mij nu ??
Want als ik voorbeeld deze pagina na toegaa:
http://www.google.be/search?hl=nl&q=test&btnI=Ik+doe+een+gok
Zal hij in je browser naar het eerste google resultaat gaan, maar met php zal hij zeggen:
Warning: get_headers(http://www.google.be/search?hl=nl&q=test&btnI=Ik+doe+een+gok) [function.get-headers]: failed to open stream: HTTP request failed! „îkî|8‘|ÿÿÿÿ2‘|«‘|ë‘|:%|òk in c:\Server\public_html\test.php on line 4
Naar waar stuurde hij mij nu ??
Ik krijg als resultaat:
Code:
PHP5 op Apache 1.zoveel geloof ik, op Mac OS 10.4.2
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
Array
(
[0] => HTTP/1.0 302 Found
[Location] => http://www.123test.nl/
[Cache-Control] => private
[Set-Cookie] => PREF=ID=17187c792149af15:TM=1125083226:LM=1125083226:S=AW72L5K5VGSIWxXk; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.be
[Content-Type] => Array
(
[0] => text/html
[1] => text/html
)
[Server] => Array
(
[0] => GWS/2.1
[1] => Apache/2.0.46 (Red Hat)
)
[Content-Length] => 152
[Date] => Array
(
[0] => Fri, 26 Aug 2005 19:07:06 GMT
[1] => Fri, 26 Aug 2005 19:07:06 GMT
)
[Connection] => Array
(
[0] => Keep-Alive
[1] => close
)
[1] => HTTP/1.1 200 OK
[X-Powered-By] => PHP/4.3.11
)
?>
Array
(
[0] => HTTP/1.0 302 Found
[Location] => http://www.123test.nl/
[Cache-Control] => private
[Set-Cookie] => PREF=ID=17187c792149af15:TM=1125083226:LM=1125083226:S=AW72L5K5VGSIWxXk; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.be
[Content-Type] => Array
(
[0] => text/html
[1] => text/html
)
[Server] => Array
(
[0] => GWS/2.1
[1] => Apache/2.0.46 (Red Hat)
)
[Content-Length] => 152
[Date] => Array
(
[0] => Fri, 26 Aug 2005 19:07:06 GMT
[1] => Fri, 26 Aug 2005 19:07:06 GMT
)
[Connection] => Array
(
[0] => Keep-Alive
[1] => close
)
[1] => HTTP/1.1 200 OK
[X-Powered-By] => PHP/4.3.11
)
?>
Code:
Code (php)
1
2
3
4
2
3
4
<?php
$url = 'http://www.google.be/search?hl=nl&q=test&btnI=Ik+doe+een+gok';
print_r(get_headers($url, true));
?>
$url = 'http://www.google.be/search?hl=nl&q=test&btnI=Ik+doe+een+gok';
print_r(get_headers($url, true));
?>
PHP5 op Apache 1.zoveel geloof ik, op Mac OS 10.4.2




