<?php
/*
$url = Web Service Url or Server Url where xml have to post
$xml = XML schema to post on server
*/
function sendXmlOverPost($url, $xml)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
// For xml, change the content-type.
curl_setopt ($ch, CURLOPT_HTTPHEADER, Array(“Content-Type: text/xml”));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // ask for results to be returned
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
// Send to remote and return data to caller.
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
?>
4 Responses to send xml over post
Leave a Reply
You must be logged in to post a comment.
You completed several good points there. I did so specific searches within the issue and found virtually all people should go together with together with your blog.
Each time I visit this website there’s a new challenge and improved that i can learn from. Haha I’ve been in your source code multiple times to master how you’re using things to put them on my site. Thanks! I can coach you on about methods to generate income.
Hey! Wanted to go out of a comment. I seriously liked this article. Continue the awesome effort.
Clear, infromative, simple. Could I send you some e-hugs?