cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Sending RAW GET through libCURL

From: Jeff Pohlmeyer <yetanothergeek_at_gmail.com>
Date: Sat, 20 Feb 2010 09:28:21 -0600

On Sat, Feb 20, 2010 at 8:49 AM, Souvik wrote:
> I have a requirement of sending “GET <URL>
> HTTP 1.0 <CRLF>Icy-MetaData:1 <CRLF><CRLF>“ .
>
> How do I send the following using libCURL API?

Something like this:

#include <curl/curl.h>

int main() {
  char*url="http://your.url/goes/here";
  CURL*curl=curl_easy_init();
  struct curl_slist* header=NULL;
  struct curl_slist* aliases=NULL; /* Only needed for IceCast servers */

  header=curl_slist_append(header, "Icy-MetaData:1");

  curl_easy_setopt(curl,CURLOPT_URL,url);
  curl_easy_setopt(curl,CURLOPT_HTTP_VERSION,
    CURL_HTTP_VERSION_1_0);
  curl_easy_setopt(curl,CURLOPT_HTTPHEADER,header);

  aliases=curl_slist_append(aliases, "ICY 200 OK");
  curl_easy_setopt(curl,CURLOPT_HTTP200ALIASES,aliases);

  CURLcode code=curl_easy_perform(curl);
  curl_easy_cleanup(curl);
  curl_slist_free_all(header);
  curl_slist_free_all(aliases);
  return code;
}
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-02-20