cURL ile bir API'den POST istegi olusturup 200 OK (olumlu bir cevap) almam gerekiyor.
<?php
// Json olarak post edilmesi gerekiyorsa
$post = json_encode(array(
"deger1"=>"merhaba",
"deger2"=>"merhaba2"
));
// Normal POST istiyorsa
$post = "deger1=merhaba°er2=merhaba2";
$ch = curl_init("API URL BU KISMA");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
$result = curl_exec($ch);
curl_close($ch);
print_r($result);