diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-11-16 18:12:19 +0100 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-11-16 18:12:19 +0100 |
commit | 671572312437e8da7ff2099a7f565c177f80767e (patch) | |
tree | 072f140983b1a50a7c7ee8fc2bf6dbf147efea42 /php/backend.php | |
parent | cac920b79aa3aa5e572ce27b048ded7cf36ba500 (diff) | |
download | merchant-frontend-examples-671572312437e8da7ff2099a7f565c177f80767e.tar.gz merchant-frontend-examples-671572312437e8da7ff2099a7f565c177f80767e.tar.bz2 merchant-frontend-examples-671572312437e8da7ff2099a7f565c177f80767e.zip |
more on track-transactions. Time prettifier.
Diffstat (limited to 'php/backend.php')
-rw-r--r-- | php/backend.php | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/php/backend.php b/php/backend.php index 418da95..120e720 100644 --- a/php/backend.php +++ b/php/backend.php @@ -4,7 +4,7 @@ include_once 'config.php'; include_once 'helpers.php'; -/** + /** * 'body' is an object, representing the JSON to POST. NOTE: we do NOT * rely on a more structured way of doing HTTP, like the one offered by * pecl_http, as its installation was NOT always straightforward. @@ -28,4 +28,21 @@ return array("status_code" => curl_getinfo($c, CURLINFO_HTTP_CODE), "body" => $r); } + + function get_to_backend($backend_uri, $args){ + $path = sprintf("%s?%s", $backend_url, http_build_query($args)); + $c = curl_init(url_join ($GLOBALS['BACKEND'], $path)); + + $options = array(CURLOPT_RETURNTRANSFER => true, + CURLOPT_CUSTOMREQUEST => "GET", + CURLOPT_SSL_VERIFYHOST => false, + CURLOPT_SSL_VERIFYPEER => false); + curl_setopt_array($c, $options); + $r = curl_exec($c); + file_put_contents("/tmp/php.out", print_r($r, true)); + return array("status_code" => curl_getinfo($c, CURLINFO_HTTP_CODE), + "body" => $r); + } + + ?> |