Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
40 | public function request( $url, array $params = array() ) { |
||
41 | curl_setopt( $this->ch, CURLOPT_URL, $url . '?' . http_build_query( $params ) ); |
||
42 | curl_setopt( $this->ch, CURLOPT_HTTPGET, true ); |
||
43 | |||
44 | $response = curl_exec( $this->ch ); |
||
45 | |||
46 | if ( curl_errno( $this->ch ) ) { |
||
47 | throw new RuntimeException( curl_error( $this->ch ), curl_errno( $this->ch ) ); |
||
48 | } else if ( curl_getinfo( $this->ch, CURLINFO_HTTP_CODE ) >= 400 ) { |
||
49 | throw new RuntimeException( 'HTTP error: ' . $url, curl_getinfo( $this->ch, CURLINFO_HTTP_CODE ) ); |
||
50 | } |
||
51 | |||
52 | return $response; |
||
53 | } |
||
54 | |||
56 |