标签归档:failed to open stream

get_headers()返回"HTTP request failed!" (Read 1135 times)

<?php
// print_r(get_headers(‘http://www.digg.com’, 1));
// print_r(get_headers(‘http://digg.com’, 1));
?>

Warning: get_headers(http://www.digg.com) [function.get-headers]: failed to open stream: HTTP request failed! in /home/jacob/workspace/tester.php on line 3
Warning: get_headers(http://www.digg.com) [function.get-headers]: failed to open stream: HTTP request failed! in /home/jacob/workspace/tester.php on line 6

Is allow_url_fopen set to true within your php.ini? If not the function will fail right away.

即,php.ini文件中打开allow_url_fopen。