Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Sending xml data in post using curl

    • 0
    • 1
    • 1
    • 2
    • 0
    • 0
    • 0
    • 0
    • 542
    Comment on it
    $xmldata ='
    <mail>
    <receive>you</receive>
    <sender>Surit</sender>
    <subject>Call me</subject>
    <message>XYZ</message>
    </mail>
    ';
    
     $url = "your url";
    
    $curlConn = curl_init($url);
    curl_setopt($curlConn, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($curlConn, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($curlConn, CURLOPT_HTTPHEADER, array("Content-Type: application/atom+xml")); 
    curl_setopt($curlConn, CURLOPT_POST, 1);
    curl_setopt($curlConn, CURLOPT_POSTFIELDS,$xmldata);
    curl_setopt($curlConn, CURLOPT_RETURNTRANSFER, 1);
    $ret = curl_exec($curlConn); 
    

    Receive xml in post :

    $dataPOST = trim(file_get_contents('php://input'));
    $xml = simplexml_load_string($dataPOST);
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: