Conditions | 3 |
Paths | 2 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
42 | public function read () |
||
43 | { |
||
44 | if ( $this->endpoint == null || $this->endpoint == "" ) { |
||
45 | throw new SourceWatcherException( "No endpoint found." ); |
||
46 | } |
||
47 | |||
48 | $curl = curl_init(); |
||
49 | |||
50 | $timeout = 5; |
||
51 | |||
52 | curl_setopt( $curl, CURLOPT_URL, $this->endpoint ); |
||
|
|||
53 | curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 ); |
||
54 | curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, $timeout ); |
||
55 | |||
56 | $response = curl_exec( $curl ); |
||
57 | |||
58 | curl_close( $curl ); |
||
59 | |||
60 | return $response; |
||
61 | } |
||
63 |