我正在尝试发送一个简单的请求并获得响应但是我得到响应作为内部错误。参数“cookie:sessionid”,ipaddress和mode都应该是http标头和我的json请求{“postcode”:“EC2A 3AY”,“propertyIdentifier”:“93A”}
<?php
$json = '{"postcode":"EC2A 3AY", "propertyIdentifier":"93A"}';
$ch = curl_init();
$header = array(
'Content-Type: application/json',
'Set-Cookie: sessionid=aertaert',
'cookie: sessionid=aertaert',
'ipaddress: 10.0.0.1',
'mode: dev'
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_URL, 'http://dev.wali.example.co.uk:8280/getAddress');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
var_dump($result);
?>