-1

Possible Duplicate:
upload a file to server without using a form?
POSTing a file via PHP curl

I have a xml file with me which is of size 10 KB. how can I send this xml file's content using http post method to some other page at other domain ? I am using PHP 5.3 in Windows with XAMPP and I can use the CURL extension. I cannot use the Http_Request method which can be used after placing the php_http.dll. Can someone help with any alternatives using native PHP or CURL extension, so that I can post this xml content to some place using http and http request.

Community
  • 1
  • 1
Ranjan Sarma
  • 1,565
  • 5
  • 22
  • 36
  • what exactly are you trying send and to where? What is their API/specs/Docs/etc? Please provider a clearer description with actual code you've attempted. – thescientist Dec 25 '12 at 12:00

1 Answers1

0
<?php
$ch = curl_init('http://url.com/post.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'xml=' . file_get_contents('xml.xml'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
echo $data;
?>

I believe that's what you wanted? Unless you meant a file upload.

David Harris
  • 2,697
  • 15
  • 27