cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Delete documents in lotus domino web-server

From: Trond <trond_at_keyex.se>
Date: Fri, 08 Feb 2008 10:36:04 +0100

I am working on a script that log in, look for messages, download them
(including any attached files) and then deletes the message from a lotus
domino server. What I have access to is a simple web-gui that I access
through CURL. So far I have been able to do the following:

Log in and save a cookie.

List all documents in my mailbox (as a xml)
 This gives me a list of all documents and their id-numbers so I can...

Open all document (one at a time) and save them to disc (using this url)
 http://000.000.000.000/mail/mapp/databas.nsf/$path/$unid?OpenDocument
 Where $path is the cookie-value (don't know if I need it but it works)
 And $unid is the documents unique ID.
 ?OpenDocument opens the document.

Save any attachments found in the saved document (just downloading any
file that are linked in the document).

So far it's all good but now things get strange...

Delete the document, if I browse the domino-server with explorer, I can
just enter an url like the following:
 http://000.000.000.000/mail/mapp/databas.nsf/$path/$unid?DeleteDocument
 This does delete the document from the server, no problem at all but
once I try to do the same with CURL, I get a page that look like this:

----------------------------------------------

Response Message

    HTTP Web Server: Invalid URL Exception

Go Back

----------------------------------------------

If I put Delete (which also works in explorer instead of DeleteDocument)
the error message change to:

    HTTP Web Server: Unknown Command Exception

I find this most frustrating since all my other url-requests work out well.

I'm greatful for any help I can get on this matter.

------------------------------------------------------------------------
Some more information on how I do this:

OpenDocument:

$fp2 = fopen("/tmp/files_from_lotus/$filename.html","w");
$curl = curl_init();
curl_setopt($curl, CURLOPT_FILE, $fp2);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_HTTPGET, true);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE
6.0; Windows NT 5.1)");
curl_setopt($curl, CURLOPT_COOKIEFILE, "/tmp/cookie.txt");
curl_setopt($curl, CURLOPT_URL,
"http://000.000.000.000/mail/mapp/databas.nsf/$path/$unid?OpenDocument");
curl_exec($curl);
curl_close($curl);
fclose ($fp2);

DeleteDocument: (doesn't work)

$curl = curl_init();
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_HTTPGET, true);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE
6.0; Windows NT 5.1)");
curl_setopt($curl, CURLOPT_COOKIEFILE, "/tmp/cookie.txt");
curl_setopt($curl, CURLOPT_URL,
"http://000.000.000.000/mail/mapp/databas.nsf/$path/$unid?DeleteDocument");
curl_exec($curl);
curl_close($curl);
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-02-08