diff --git a/src/indeed.php b/src/indeed.php index 5711f33..76d81e0 100644 --- a/src/indeed.php +++ b/src/indeed.php @@ -1,6 +1,6 @@ publisher = $publisher; $this->version = $version; + $this->timeout = $timeout; } public function search($args){ @@ -32,6 +33,8 @@ private function process_request($endpoint, $args){ $args["format"] = $format; $c = curl_init(sprintf("%s?%s", $endpoint, http_build_query($args))); curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE); + curl_setopt($c, CURLOPT_CONNECTTIMEOUT, $this->timeout); + curl_setopt($c, CURLOPT_TIMEOUT, $this->timeout); $result = curl_exec($c); curl_close($c); $r = (!$raw ? json_decode($result, $assoc = true) : $result); @@ -58,4 +61,4 @@ private function validate_args($required_fields, $args){ return $args; } -} \ No newline at end of file +}