Example #1
0
 /**
  * Makes a request to a specified URL and returns the response.
  *
  * @param  string $url The URL to which the request is to be sent.
  * @param  reference $success **OPTIONAL. OUTPUT.** After the method is called, the value of this parameter tells
  * whether the request was successful.
  * @param  int $timeoutSeconds **OPTIONAL. Default is** *no timeout*. The number of seconds after which the
  * request should time out.
  *
  * @return CUStringObject The response that was received for the request.
  */
 public static function read($url, &$success = null, $timeoutSeconds = null)
 {
     assert('is_cstring($url) && (!isset($timeoutSeconds) || is_int($timeoutSeconds))', vs(isset($this), get_defined_vars()));
     $inetRequest = new self($url);
     if (isset($timeoutSeconds)) {
         $inetRequest->setRequestTimeout($timeoutSeconds);
     }
     $content = $inetRequest->send($success);
     if (!$success) {
         $content = "";
     }
     return $content;
 }