$postdata = http_build_query([
'param1' => 'val',
]);
$context = stream_context_create(['http' => [
'method' => 'POST',
'header' => 'Content-Type: application/x-www-form-urlencoded',
'content' => $postdata
]]);
$result = file_get_contents('http://localhost:8787/delete', false, $context);
$postdata = '{}';
$result = file_get_contents('https://testcom', false, stream_context_create([
'http' => [
'method' => 'POST',
'header' => 'Content-Type: application/json',
'content' => $postdata
]
]));
Без ssl проверок
<?php
$d = json_encode($_REQUEST, JSON_PRETTY_PRINT);
$url = "https://api.domain.ru";
$arrContextOptions = array(
"ssl" => array(
"verify_peer" => false,
"verify_peer_name" => false,
),
);
file_get_contents("$url/api/parsers/stripchat?" . http_build_query($_REQUEST), false, stream_context_create($arrContextOptions));