any help is very appreciated, thanks in advance.
my storeCallback.php file which i have hosted at: http://xxxxx/storeCallback.php
<?php
die(var_dump($_REQUEST));
and i am creating a post json raw request as:
1.
$url = "http://xxxxx/storeCallback.php/storeCallback.php";
$body =['foo' => 'bar'];
$body_string = json_encode($body);
$header = array(
'Accept: application/json',
'Content-Type: application/json',
'Content-Length: '.strlen($body_string),
);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $body_string);
$json_response = curl_exec($curl);
$response = json_decode($json_response, true);
die(var_dump($response));
2.
$url = "http://xxxxx/storeCallback.php/storeCallback.php";
$body =['foo' => 'bar'];
$body_string = json_encode($body);
$header = array(
'Accept: application/json',
'Content-Type: application/json',
'Content-Length: '.strlen($body_string),
);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $body_string);
$json_response = curl_exec($curl);
$response = json_decode($json_response, true);
die(var_dump($response));
3.
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post('http://xxxxx/storeCallback.php/storeCallback.php', [
GuzzleHttp\RequestOptions::JSON => ['for' => "bar"],
]);
echo $response->getBody()->getContents();
Nothing is working, in all cases response is [] (empty array) but sending request like http://xxxxx/storeCallback.php/storeCallback.php?foo=bar is working