|  | Posted by "-k." on 06/19/48 11:27 
Here is my problem. I need to post an XML file to someone else's server. I'm trying to do thiswith the curl package.
 
 Once I post the XML file to the other server one of two things will happen. The server will either
 take the info in the XML file and forward the user along to some other page or the page will
 return some errors, if for example there is something wrong with the XML i send.
 
 What I would like to do is post the data to the other server and if everything is OK just allow
 the user to be forwarded along, otherwise Id like to catch whatever errors the server spits back.
 
 
 Setting this up on two of my development boxes seems to work fine. However when I try to send this
 to the other server (which i have no control over) it doesnt work. It's seems like it is having
 trouble redirecting my request. When I send the request I get a Server Error in '/' Application
 which looks to be like a generic ASP error( I guess). If I comment out the FOLLOWLOCATION
 curl_setopt line all I get in response, other than headers, is "Object moved" message with a link,
 the link however seems like a relative link because if i click on it tries to find the linked page
 on my server. I'm wondering if something in my request is breaking whatever forwarding goes on
 internally.
 
 Stiped to the basics this is my script:
 <?Php
 $url = "https://somebody.else.com/this/some_script.aspx";
 
 $postfields = array();
 $postfields['some_xml'] = urlencode($some_xml_ive_generated);
 
 $ch = curl_init();
 
 curl_setopt($ch, CURLOPT_URL, $url);
 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($ch, CURLOPT_POST, 1);
 curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
 $output = curl_exec($ch);
 curl_close($ch);
 
 print $output;
 ?>
 
 A couple of things:
 -I'm pretty new to curl so i could easily be overlooking something.
 -The https:// doesn't seem to be the problem
 -Generating a form that submits itself with javascript when loaded seems to work fine.
 -The url in my location bar never seems to change even when i post between my two development
 boxes and my simple response test script works.
 -I have no idea what happens nor any control over the other box. I've e-mailed my contact there
 with no response.
 -The other box is running IIS6 with ASP (or at least that is what headers from it claim).
 -The https://somebody.else.com/this/some_script.aspx link (the actual one not the  one used here
 is definitely correct).
 -Am i screwing up the headers or something?
 -Is what Im doing even possible?
 
 Any suggestions for things to try? Or simple things Ive overlooked? Ive googled around and read
 a few basic curl tutorials but they havent helped me sort this out.
 
 
 
 
 
 -k.
 
 __________________________________________________
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around
 http://mail.yahoo.com
  Navigation: [Reply to this message] |