Hey all,
I have came across this during my Zend Cert study, can anyone advise?
Q: What is wrong with the following code snippet? Assume default configuration values apply.
Answers (Choose 1):PHP Code:<?php
$fp = fsockopen('www.php.net', 80);
fwrite($fp, "GET / HTTP/1.0\r\nHost: www.php.net\r\n");
$data = fread($fp, 8192);
?>
The request is blocking and may cause fread() to hang
The HTTP request is malformed
This script should be re-written using fgets() instead of fread()
The request is non-blocking and fread() may miss the response
You cannot use fwrite() with fsockopen()
Many thanks,
Picco


Reply With Quote

Bookmarks