If you are working in a Software Company you may need to know this stuff for sure!.
Do you want to POST XML data to a third party site and get the response from the site?. This code will help you then!
<?php //paste your XML file here $xml = ' <?xml version="1.0" encoding="UTF-8"?> <Parent> <Child> <Name>Roshini</Name> <Age>5</Age> </Child> </Parent>'; // give the path of the Third party site $url = "https://www.example.com/"; $ch = curl_init($url); //curl_setopt($ch, CURLOPT_MUTE, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml')); curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); echo $output; curl_close($ch); ?>
What if I have server IP addres & post number for posting data.. ??
Any idea..
If you have server IP address & Port number then use it as
$URL = IPaddress:Portnumber/folder like
$url = 192.168.1.100:8080/folder
How to PUT?
How to send xml file as request?
Hi agurchand
Thanks for sharing useful tutorials.
How to pass this value using a form? so the user will input this over a form not directly in script