Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function fncPostXMLToURL($url, $page, $xml_data) {
- $headers = array(
- "POST ".$page." HTTP/1.0",
- "Content-type: text/xml;charset=\"utf-8\"",
- "Accept: text/xml",
- "Cache-Control: no-cache",
- "Pragma: no-cache",
- "Content-length: ".strlen($xml_data),
- );
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL,$url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_TIMEOUT, 60);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
- // Apply the XML to our curl call
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_data);
- $data = curl_exec($ch);
- if (curl_errno($ch)) {
- return "Error: " . curl_error($ch);
- } else {
- return $data;
- curl_close($ch);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement