Skip to content

Latest commit

 

History

History
25 lines (21 loc) · 844 Bytes

0689.md

File metadata and controls

25 lines (21 loc) · 844 Bytes

Considering the code below, which of these statements are true?

ini_set("allow_url_fopen", "1");
$page = file_get_contents("http://www.codepunker.com");
if ($page!=FALSE) {
    echo "Successfully fetched website contents";
} else {
    echo "An error has occurred";
}
  • A) The "allow_url_fopen" option can not be changed through ini_set. It can only be set in php.ini for security reasons
  • B) The if statement should be "if($page!==FALSE)" because "file_get_contents" can return non boolean values which evaluate to false
  • C) The correct setting for loading web pages from a script is "allow_url_include"
  • D) an error
Answer

Answer: A, B