commit 51c8aca5a82ba80f36fe34ac4679a99d6c7d3ff6
parent 691d5288fca46ced4ffd391229660969355c875b
Author: Florian Dold <florian.dold@gmail.com>
Date: Wed, 2 Mar 2016 14:29:49 +0100
fix url concatenation
Diffstat:
4 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/copylib/merchants.php b/copylib/merchants.php
@@ -143,9 +143,8 @@ function generate_contract($amount_value,
* Feed `$json` to the backend and return the "(pecl) http response object"
* corresponding to the `$backend_relative_url` call
*/
-function give_to_backend($backend_host, $backend_relative_url, $json){
- $url = (new http\URL("http://$backend_host"))
- ->mod(array ("path" => $backend_relative_url), http\Url::JOIN_PATH);
+function give_to_backend($backend_relative_url, $json){
+ $url = url_join("http://".$_SERVER["HTTP_HOST"], $backend_relative_url);
$req = new http\Client\Request("POST",
$url,
diff --git a/examples/blog/essay_contract.php b/examples/blog/essay_contract.php
@@ -59,8 +59,7 @@
"taxes" => $teatax,
"now" => $now,
"fulfillment_url" => $fulfillment_url));
- $resp = give_to_backend($_SERVER['HTTP_HOST'],
- "backend/contract",
+ $resp = give_to_backend("backend/contract",
$contract_json);
$status_code = $resp->getResponseCode();
http_response_code ($status_code);
diff --git a/examples/blog/essay_fulfillment.php b/examples/blog/essay_fulfillment.php
@@ -75,8 +75,7 @@
array(),
$now,
get_full_uri());*/
- $resp = give_to_backend($_SERVER['HTTP_HOST'],
- "backend/contract",
+ $resp = give_to_backend("backend/contract",
$contract_rec);
if ($resp->getResponseCode() != 200){
echo json_encode(array(
diff --git a/examples/blog/essay_pay.php b/examples/blog/essay_pay.php
@@ -60,8 +60,7 @@
// FIXME put some control below
// with the article that's going to be payed
- $resp = give_to_backend($_SERVER['HTTP_HOST'],
- "backend/pay",
+ $resp = give_to_backend("backend/pay",
$deposit_permission);
$status_code = $resp->getResponseCode();
http_response_code ($status_code);