Thomas,

There may be a way to trick libURL into sending HEAD instead of GET, but if you don't mind getting your hands dirty with sockets a bit, you can do something like:

put "www.myserver.com:80" into tSocket
open socket tSocket
write "HEAD /path/to/file.html HTTP/1.0"&crlf&"Host: myserver.com" to socket toSocket
read form socket tSocket until empty
put it into tReply
close socket tSocket

Basically, you write a two line request to port 80 of the desired server, then read back the reply. Line 1 of the reply will give you an HTTP status code. The request just looks like:

LINE 1:  HEAD /some/file/path HTTP/1.0
LINE 2:  Host: www.someserver.com

Lines end with carriage return + linefeed.

Then the reply will give you something like "200 OK" in the first line, or "404 NOT FOUND", etc.

Of course if you are checking for the existence of things, you will have to handle failed connections. You could also use a shell() call to something like curl, which has a flag to send HEAD requests.

Hello,

can anybody tell me how to retrieve only the header from a URL, using the HEAD method? "The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response." (RFC 2616)
This could be helpful to check the validity of URLs.

Regards
Thomas

----
Thomas Fischer
Permosergasse 23a
5026 Salzburg
Tel.: +43 662 621498
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to