curl-and-php
File Postilating Errornation
Date: Wed, 04 Jun 2003 13:52:02 -0800
Ok, so I'm not sure what's causing the error I'm getting, but I've narrowed
it down a bit, and I'm hoping someone might be able to help me eliminate a
few possibilities.
I've got a PHP script that's catching some POSTed data and writing an XML
file. The script then has to POST that XML file to a NetLedger server over
HTTPs. I've got the certificate, I've got the connection, and I know my XML
is valid because NetLedger also has a UI manual upload and it processes
just fine from there. But, if I echo the response from the other server, I get:
Failed parsing XML: Content is not allowed in prolog.
Reason:org.xml.sax.SAXParseException: Content is not allowed in prolog.
I haven't been able to find much on that particular error, but from what I
have found, it seems one of the possible causes of that Java parser problem
is an incorrect file transfer type. So, here's my code and, again, I'm
hoping someone a bit brainier than I can help me figure out what's going
on. Like I said, I'm not certain that it's a cURL/PHP issue, but I figured
it couldn't hurt to ask.
<?php
$cert = "osb-bundle.crt";
$file = "test.xml";
$post_url = "https://partners.netledger.com/s/SmbXml";
$formvars['mediafile'] = "@$file";
$formvars['submit'] = "1";
$ch = curl_init($post_url);
curl_setopt($ch, CURLOPT_REFERER, $_SERVER["SCRIPT_URI"]);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, "****************");
curl_setopt($ch, CURLOPT_SSLCERT, $cert);
curl_setopt($ch, CURLOPT_SSLVERSION, 3);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $formvars);
echo curl_exec($ch);
echo curl_error($ch);
curl_close ($ch);
?>
-- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: skeller_at_healthtvchannel.org Web: www.healthtvchannel.org ------------------------------------------------------- This SF.net email is sponsored by: Etnus, makers of TotalView, The best thread debugger on the planet. Designed with thread debugging features you've never dreamed of, try TotalView 6 free at www.etnus.com.Received on 2003-06-04