How do I recreate the following curl statement in PHP?
curl http://www.example.com/path/to/folder/ -X SEARCH -d @dasl.xml
This is what I still have, and the dasl.xml file is what disables me.
$ch = curl_init("http://www.example.com/path/to/folder/");
$fp = fopen("webdav.xml", "w");
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "SEARCH");
curl_exec($ch);
curl_close($ch);
fclose($fp);
The dasl.xml file contains the XML for the WebDAV request. Is there an option that I can use to transfer this file? Or is there a way to pass the contents of the file as a string or something else?
The error statement that I am currently receiving is
DaslStatement: 267 - SAX analyzer error Premature end of file.
Thanks for the help.
Update:
Here is an example dasl.xml file:
<d:searchrequest xmlns:d="DAV:">
<d:basicsearch>
<d:select>
<d:prop><d:getcontentlength/></d:prop>
</d:select>
<d:from>
<d:scope>
<d:href>/container1/</d:href>
<d:depth>infinity</d:depth>
</d:scope>
</d:from>
<d:where>
<d:gt>
<d:prop><d:getcontentlength/></d:prop>
<d:literal>10000</d:literal>
</d:gt>
</d:where>
<d:orderby>
<d:order>
<d:prop><d:getcontentlength/></d:prop>
<d:ascending/>
</d:order>
</d:orderby>
</d:basicsearch>
</d:searchrequest>
Additional information on DASL is here: http://greenbytes.de/tech/webdav/rfc5323.html and [http://www.webdav.org/dasl/] [2]
source
share