summaryrefslogtreecommitdiff
path: root/doc/examples/post_to_backend.php
blob: e89b52836791af48ecd847445b0051239709be82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function post_to_backend($backend_relative_url, $json)@{
  $url = "https://shop.com$backend_relative_url";

  $req = new http\Client\Request("POST",
                                 $url,
                                 array ("Content-Type" => "application/json"));

  $req->getBody()->append($json);

  // Execute the HTTP request
  $client = new http\Client;
  $client->enqueue($req)->send();
  return $client->getResponse();
@}