/** * The failover stub. Handles the application fault * * @param Exception $e uncaught exception that caused fault * @return void */ protected function handle500(Exception $e) { $response = $this->request->getResponse(); $response->setStatus(new HttpStatus(HttpStatus::CODE_500)); $clname = get_class($e); $out = <<<EOT \t<h1>Internal Server Error</h1> \t{$clname} : {$e->getMessage()} \t<hr /> \t<h2>Call Stack</h2> \t<pre>{$e->getTraceAsString()}</pre> EOT; $response->write($out)->finish(); if (defined('BUGS_EMAIL')) { $this->notify500(BUGS_EMAIL, $e); } }
/** * Runs the proccess of handing the action method result * * @param IActionResult $actionResult * * @return void */ protected function processResult(IActionResult $actionResult) { $actionResult->handleResult($this->request->getResponse()); }
<?php $url = 'http://www.360doc.com/content/15/0918/21/12146850_499980507.shtml#'; $request = new WebRequest($url); echo '<pre>'; $obj = $request->getResponse(); //var_dump($obj); // echo $obj->content; class WebRequest { var $url = ''; var $host = ''; var $port = 80; var $path = '/'; var $method = ''; var $postdata = ''; var $cookies = array(); var $accept = 'text/xml,application/xml,application/xhtml+xml,text/html,text/plain,image/png,image/jpeg,image/gif,*/*'; var $accept_language = 'zh-cn'; var $accept_encoding = 'gzip'; // var $user_agent = 'ErikClient/1.0'; var $user_agent = 'Mozilla/5.0 (Windows NT 5.1; rv:22.0) Gecko/20100101 Firefox/22.0'; var $use_gzip = false; var $username; var $password; var $timeout = 20; /** * 构造函数 * @public * @param <string> $url 请求地址 * @param <string> $method 请求方式