Option 1:
$data= array( "Code" => "abcde", "Id" => "A007", "RefNo" => "123456", "UserName" => "QWE", "UserEmail" => "[email protected]", ); $url="https://testing.php"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result=curl_exec($ch); curl_close ($ch); echo $result; }
Option 2:
<form method="post" action="https://testing.php"> <input type="hidden" value="abcde" name="Code"> <input type="hidden" value="A007" name="Id"> <input type="hidden" value="QWE" name="UserName"> <input type="hidden" value="[email protected]" name="UserEmail"> <input type="hidden" value="123456" name="RefNo"> <input type="submit" name="submit"> </form>
Is there any different between A and B? Because i tried both but the curl only get the "fail" response from the api.