cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: File Exists

From: <RBramante_at_on.com>
Date: Fri, 20 Jun 2003 20:33:19 -0400

You're calling it wrong. You need to pass a pointer to a long as the third
parameter to get the HTTP code. The return code you're getting is the curl
error CURLE_BAD_FUNCTION_ARGUMENT which should now make sense.

Call it like this:

long httpcode = 0;

if(curl_easy_getinfo(curl, CURLINFO_HTTP_CODE, &httpcode) == CURLE_OK)
{
      /* now you can get your HTTP status code out of httpcode */
}

Make sure to read the man pages, they are your friends!

                                                                                                                                    
                      "Alex Salsinha"
                      <manobro87_at_hotmail.com> To: curl-library_at_lists.sourceforge.net
                      Sent by: cc:
                      curl-library-admin_at_lists.sour Subject: Re: File Exists
                      ceforge.net
                                                                                                                                    
                                                                                                                                    
                      06/20/2003 06:38 PM
                      Please respond to
                      curl-library
                                                                                                                                    
                                                                                                                                    

Thks RBramante_at_on.com for you quick awser.

Sorry to ask this, but I tried to do a program like you said, but the
CURLINFO_HTTP_CODE itīs always 43.
I think I program it wrong. Here itīs the final Code.

#include <stdio.h>
#include <curl/curl.h>
#pragma comment(lib, "libcurl.lib")

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

  curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "http://www.server.com/file.htm");

    res = curl_easy_perform(curl);

    infot = curl_easy_getinfo(curl, CURLINFO_HTTP_CODE);
    curl_easy_cleanup(curl);
  }
  return 0;
}

The infot itīs always 43.
Thks again.

_________________________________________________________________
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

-------------------------------------------------------
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-21