Пример #1
0
 public function create($url)
 {
     /*
     Static shortcut method to create and configure a new instance
     		of this class. Query is not automatically performed, but the
     		class is preconfigured so you can call doRequest() after
     		setting whatever other parameters you might need.
     (If you don't need to set any other parameters, you most likely
     		want one of the quickGet() or quickPost() methods instead.)
     */
     $bits = parse_url($url);
     $host = $bits['host'];
     $port = isset($bits['port']) ? $bits['port'] : 80;
     $path = isset($bits['path']) ? $bits['path'] : '/';
     if (isset($bits['query'])) {
         $path .= '?' . $bits['query'];
     }
     $client = new HttpClient($host, $port);
     $client->setPath($path);
     $client->setMethod("GET");
     return $client;
 }