tags:

views:

20

answers:

0

hi, i'm trying to send a simple request and get response however i get response as internal error. parameters "cookie: sessionid", ipaddress and mode are all supposed to be http headers and my json request {"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);
?>