how to send xml file to server backend using php?

tehfatguy

New Member
I have fetched data from server using this code, `$server = 'LOCALHOST:9000';\[code\]$headers = array("Content-type: text/xml","Content-length: ".strlen($requestXML),"Connection: close");$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $server);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_TIMEOUT, 100);curl_setopt($ch, CURLOPT_POST, true);curl_setopt($ch, CURLOPT_POSTFIELDS, $requestXML);curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);$data = http://stackoverflow.com/questions/15718173/curl_exec($ch);if(curl_errno($ch)){ print curl_error($ch); echo" something went wrong..... try later";}else{echo " request accepted"; print $data; curl_close($ch);}`\[/code\]Now I have to do reverse, how to send the data into server using php? curl method is the only way or is there any other method to do the same. Give me some example.
 
Back
Top