Imdb\Request::sendRequest PHP Method

sendRequest() public method

Send a request to the movie site
public sendRequest ( ) : boolean
return boolean success
    public function sendRequest()
    {
        $this->responseHeaders = array();
        curl_setopt($this->ch, CURLOPT_HTTPHEADER, $this->requestHeaders);
        $this->page = curl_exec($this->ch);
        if ($this->page !== false) {
            return true;
        }
        if ($this->config->throwHttpExceptions) {
            throw new Exception\Http("Failed fetch url [{$this->urltoopen}] " . curl_error($this->ch));
        }
        return false;
    }

Usage Example

Beispiel #1
0
 public function test_get()
 {
     $config = new \Imdb\Config();
     $request = new Request('https://images-na.ssl-images-amazon.com/images/M/MV5BMDMyMmQ5YzgtYWMxOC00OTU0LWIwZjEtZWUwYTY5MjVkZjhhXkEyXkFqcGdeQXVyNDYyMDk5MTU@._V1_UY268_CR6,0,182,268_AL_.jpg', $config);
     $ok = $request->sendRequest();
     $this->assertTrue($ok);
     $headers = $request->getLastResponseHeaders();
     $this->assertTrue(count($headers) > 5);
     $this->assertEquals($request->getresponseheader('Content-Type'), 'image/jpeg');
 }
All Usage Examples Of Imdb\Request::sendRequest