PHP: başlığı üzerinden geçen veri

0 Cevap

Ben basit bir istek gönderebilir ve ancak ben iç hata olarak cevap almak yanıt almak için çalışıyorum. parametreler "cookie: oturumkimliği", ipadresi ve mod tüm http başlıkları ve benim json istek olması gerekiyordu {"posta kodu": "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);
?>

0 Cevap