Добрый день, подскажите как отправить в теле запроса свой JSON, есть стандартный скрипт
<?php
/**
* http://www.php.net/manual/ru/function.curl-exec.php
*/
/**
* Send a POST request using cURL
* @param string $url to request
* @param array|string $post values to send
* @param array $options for cURL
* @internal param array $get
* @return string
*/
function curl_post($url, $post = null, array $options = array()) {
$defaults = array(
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_URL => $url,
CURLOPT_FRESH_CONNECT => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FORBID_REUSE => 1,
CURLOPT_SSL_VERIFYHOST =>0,//unsafe, but the fastest solution for the error " SSL certificate problem, verify that the CA cert is OK"
CURLOPT_SSL_VERIFYPEER=>0, //unsafe, but the fastest solution for the error " SSL certificate problem, verify that the CA cert is OK"
CURLOPT_POSTFIELDS => $post
);
$ch = curl_init();
curl_setopt_array($ch, ($options + $defaults));
if( ! $result = curl_exec($ch)){
trigger_error(curl_error($ch));
}
curl_close($ch);
return $result;
}
и мне нужно на этот адрес
curl_post("https://iiko.biz:9900/api/0/orders/add?access_token=$access_token&requestTimeout=10000");
Добавить ещё свой JSON, как это сделать?) Заранее спасибо!