curl-library
relative url to absolute
Date: Sat, 23 Feb 2008 16:31:16 +0100
Hi,
i want to build urls from relative urls found in the parsed html file and the url given by
curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url);
problem:
how to detect if "url" is a directory or a file?
example:
http://xyz.com/hans.php/index.html
is a valid url and i can get http://xyz.com/hans.php from curl_easy_getinfo(..). i dont know, if http://xyz.com/hans.php is a path to the file hans.php or a path to the directory http://xyz.com/hans.php/ with the file index.html.
my current solution:
append '/' to http://xyz.com/hans.php.
connect http://xyz.com/hans.php/ with
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 0);
if response code is 200, hans.php cant be a file, and i can use http://xyz.com/hans.php/ to build the absolute urls.
is there any other solution without two connections?
Thank you for your help,
regards
Hans
-- Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessengerReceived on 2008-02-23