Hi,
I have a problem with the HTTP implementation of the PEAR package:
I try to PUT an XML instance to an XML database (eXist), but it always
puts a binary:
<?php
require_once "HTTP/Request.php";
$URL = 'http://ap34.ifi.inform atik.uni-goettingen.de:8 081/exist/servlet/db/may/hamlet.xml';
$req =& new HTTP_Request("" );
$req->setBasicAuth($ user, $passwd);
$req->setURL($URL) ;
$req->setMethod("PUT ");
$req->addHeader("Con tent-Type", "text/xml");
$req->addFile("hamle t.xml","/home/may/public_html/PHP/hamlet.xml", "text/xml");
$response = $req->sendRequest( );
?>
When looking into the database, there is also not the XML file, but
there is a complete HTTP request:
***
--HTTP_Request_f4 2cc34621bc820ec d46b8f6ef61eb7e
Content-Disposition: form-data; name="hamlet.xm l"; filename="hamle t.xml"
Content-Type: text/xml
<?xml version="1.0"?>
<!DOCTYPE PLAY SYSTEM "play.dtd">
<PLAY>
<TITLE>The Tragedy of Hamlet, Prince of Denmark</TITLE>
etc.
****
It seems not ot be a problem of the database, since it works well when doing
the same with python (a sample that is included into the documentation of eXist),
i.e., tha database work correctly when it receives a correct PUT.
Can anybody give me an example how HTTP PUT is applied correctly with PEAR?
THX,
Wolfgang
I have a problem with the HTTP implementation of the PEAR package:
I try to PUT an XML instance to an XML database (eXist), but it always
puts a binary:
<?php
require_once "HTTP/Request.php";
$URL = 'http://ap34.ifi.inform atik.uni-goettingen.de:8 081/exist/servlet/db/may/hamlet.xml';
$req =& new HTTP_Request("" );
$req->setBasicAuth($ user, $passwd);
$req->setURL($URL) ;
$req->setMethod("PUT ");
$req->addHeader("Con tent-Type", "text/xml");
$req->addFile("hamle t.xml","/home/may/public_html/PHP/hamlet.xml", "text/xml");
$response = $req->sendRequest( );
?>
When looking into the database, there is also not the XML file, but
there is a complete HTTP request:
***
--HTTP_Request_f4 2cc34621bc820ec d46b8f6ef61eb7e
Content-Disposition: form-data; name="hamlet.xm l"; filename="hamle t.xml"
Content-Type: text/xml
<?xml version="1.0"?>
<!DOCTYPE PLAY SYSTEM "play.dtd">
<PLAY>
<TITLE>The Tragedy of Hamlet, Prince of Denmark</TITLE>
etc.
****
It seems not ot be a problem of the database, since it works well when doing
the same with python (a sample that is included into the documentation of eXist),
i.e., tha database work correctly when it receives a correct PUT.
Can anybody give me an example how HTTP PUT is applied correctly with PEAR?
THX,
Wolfgang
Comment