can no longer avoid recording the curl response code
This commit is contained in:
parent
bf77043b51
commit
d96ae0f9f5
3 changed files with 23 additions and 5 deletions
16
boot.php
16
boot.php
|
@ -100,6 +100,8 @@ class App {
|
|||
private $baseurl;
|
||||
private $db;
|
||||
|
||||
private $curl_code;
|
||||
|
||||
function __construct() {
|
||||
|
||||
$this->config = array();
|
||||
|
@ -185,6 +187,14 @@ class App {
|
|||
));
|
||||
}
|
||||
|
||||
function set_curl_code($code) {
|
||||
$this->curl_code = $code;
|
||||
}
|
||||
|
||||
function get_curl_code() {
|
||||
return $this->curl_code;
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
// retrieve the App structure
|
||||
|
@ -347,6 +357,9 @@ function fetch_url($url,$binary = false) {
|
|||
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
|
||||
|
||||
$s = curl_exec($ch);
|
||||
$info = curl_getinfo($ch);
|
||||
$a = get_app();
|
||||
$a->set_curl_code($info['http_code']);
|
||||
curl_close($ch);
|
||||
return($s);
|
||||
}}
|
||||
|
@ -376,6 +389,9 @@ function post_url($url,$params) {
|
|||
}
|
||||
|
||||
$s = curl_exec($ch);
|
||||
$info = curl_getinfo($ch);
|
||||
$a = get_app();
|
||||
$a->set_curl_code($info['http_code']);
|
||||
curl_close($ch);
|
||||
return($s);
|
||||
}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue