php - XML File posting through CURL not Hitting the url -


while posting xml content 1 server other server, not getting added. i'm using curl post xml files server. getting following response:

http/1.1 200 ok date: thu, 21 jul 2011 08:13:02 gmt server: apache/2.2.8 (ubuntu) php/5.2.4-2ubuntu5.6 suhosin-patch mod_ssl/2.2.8 openssl/0.9.8g x-powered-by: php/5.2.4-2ubuntu5.6 set-cookie: phpsessid=6846cb7e65f6f6d6d87f163a681f0543; path=/ expires: thu, 19 nov 1981 08:52:00 gmt cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 pragma: no-cache content-length: 5721 content-type: text/html; charset=utf-8 

this code

$file_path= www_root.$xmlfilename;           $xmldata = file_get_contents($file_path); $request = 'http://www.sample.com/someaction'; $postargs = 'xml='.urlencode($xmldata).'&filename='.urlencode($xmlfilename);  // curl session object $session = curl_init($request);  // set post options. curl_setopt($session, curlopt_post, true); curl_setopt($session, curlopt_postfields, $postargs); curl_setopt($session, curlopt_header, true); curl_setopt($session, curlopt_returntransfer, true);  // post , close session $response = curl_exec($session); print_r( $response); 

note: allow_url_fopen , curl enabled in both servers.

try assigning this:

$postargs = array('xml' => urlencode($xmldata), 'filename' => urlencode($xmlfilename))

both items should appear in $_post['xml'] , $_post['filename'] in receiving side (or equivalent if not php).

edit

ok may need @ streaming xml file using curlopt_readfunction.

see bit of example http://zingaburga.com/2011/02/streaming-post-data-through-php-curl-using-curlopt_readfunction/


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -