cURL / Mailing Lists / curl-library / Single Mail

curl-library

File Exists

From: Alex Salsinha <manobro87_at_hotmail.com>
Date: Fri, 20 Jun 2003 22:52:50 +0100

Well, I´m tring to do a program that restrives a url, and if the page
doesn´t exists, does a printf()
Sayng:

"The requested page doesn´t exist".

I´m using this little and basic code using libcurl. But if the page doesn´t
exists it still restrieves something like this:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>404 Not Found</TITLE>
</HEAD><BODY>
<H1>Not Found</H1>
The requested URL /file.htm was not found on this server.<P>
<HR>
<ADDRESS>Apache/1.3.27 Server at www.server.com Port 80</ADDRESS>
</BODY></HTML>

With this code:

#include <stdio.h>
#include <curl/curl.h>

int main(void)
{
  CURL *curl;
  CURLcode res;

  curl = curl_easy_init();

  if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "http://www.servere.com/file.htm");
    res = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
  }
  return 0;
}

If some could tell me if theres a function to see if the page/file exists,
or how I can add it, it would be really apreciated.
Thks a lot

_________________________________________________________________
MSN Hotmail, o maior webmail do Brasil. http://www.hotmail.com

-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
Received on 2003-06-23