From faf3330c7f7bad0932e05e9f149be4a559575f56 Mon Sep 17 00:00:00 2001 From: Miha Petkovsek Date: Tue, 15 Nov 2016 19:08:52 +0100 Subject: Extended timeout from 4 to 30 seconds --- php-client/class.phpipam-api.php | 4 ++-- php-client/example.php | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/php-client/class.phpipam-api.php b/php-client/class.phpipam-api.php index 79f0e64..08b04e5 100644 --- a/php-client/class.phpipam-api.php +++ b/php-client/class.phpipam-api.php @@ -648,7 +648,7 @@ class phpipam_api_client { CURLOPT_URL => $url, CURLOPT_HEADER => 0, CURLOPT_VERBOSE => $this->debug, - CURLOPT_TIMEOUT => 4, + CURLOPT_TIMEOUT => 30, CURLOPT_HTTPHEADER => array("Content-Type: application/json"), CURLOPT_USERAGENT => 'phpipam-api php class', // ssl @@ -839,7 +839,7 @@ class phpipam_api_client { CURLOPT_URL => $this->api_url.$this->api_app_id."/user/", CURLOPT_HEADER => 0, CURLOPT_VERBOSE => $this->debug, - CURLOPT_TIMEOUT => 4, + CURLOPT_TIMEOUT => 30, CURLOPT_USERAGENT => 'phpipam-api php class', // ssl CURLOPT_SSL_VERIFYHOST => 0, diff --git a/php-client/example.php b/php-client/example.php index 74ea511..9d3eb9e 100644 --- a/php-client/example.php +++ b/php-client/example.php @@ -14,12 +14,17 @@ require("class.phpipam-api.php"); # init object with settings from $API = new phpipam_api_client ($api_url, $api_app_id, $api_key, $api_username, $api_password, $result_format); # debug - only to debug curl -$API->set_debug (false); +$API->set_debug (true); # execute - result is stored to $API->result, save it to own array if multiple calls needed after execute -$API->execute ("GET", "sections", array(5), array(), $token_file); + +$API->execute ("POST", "addresses", array("first_free", "7"), array(), $token_file); + + +// $API->execute ("DELETE", "subnets", array(7, "permissions"), array(), $token_file); +// $API->execute ("POST", "vrf", array(), array("number"=>"114","name"=>"API"), $token_file); # ger result $result = $API->get_result(); # print result -print_r($result); -?> \ No newline at end of file +print_r(json_decode($result, true)); +?> -- cgit v1.2.3