<?php
    $url = 'http://v...content-available-to-author-only...e.in:628/B1iXcellerator/exec/ipo/.DEV.sap.httpcallpost.sap.httpcallpost/com.sap.b1i.dev.scenarios.setup/sap.httpcallpost/sap.httpcallpost.ipo/httpcallpost.sap.httpcallpost';

          $data = array("data"=>
          array(
            "DocDate" =>"2025-03-03",
            "DocDueDate" => "2025-03-10",
            "CardCode" => "C001",
            "FirstName" => "John",
            "LastName" => "Doe",
            "WebRefNo" =>  "WEB12345",
            "mage_orderid" => "MAGE001",
            "PhoneNumber" => "9876543210",
            "Email" =>"john.doe@example.com",
            "FreightCharges" => 50,
            "PaymentRef" => "PAY12345",
            "ShipToStreetAddress" =>  "123 Main Street",
            "ShipToZipCode" =>  "625020",
            "ShipToCity" =>"MDU",
            "ShipToState" =>"TN",
            "BillToStreetAddress" => "123 Main Street",
            "BillToZipCode" =>   "625020",
            "BillToCity" => "MDU",
            "BillToState" => "TN",
          ));
          //error_log(print_r(json_encode($data),true));

          //$username = "Bea";
          //$password= "Bea#1";
          $postdata = json_encode($data);
          $ch = curl_init($url);
          curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
          curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
          curl_setopt($ch, CURLOPT_POST, 1);
          curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          curl_setopt($ch,CURLOPT_TIMEOUT,10);
          curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
          curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
          //curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
          // print_r($postdata);exit();

          $result = curl_exec($ch);
          error_log($result);
          curl_close($ch);
          if($result){
          $res = json_decode($result,true);
            $ress = json_decode($res, true);
          print_r($ress['WebOrderRefNo']);exit();
          }
?>
