Open2300 - Deliver To CW Using Curl
You are here: Foswiki>Open2300 Web>DeliverToCWUsingCurl (26 Dec 2008, SteveHoldoway)Edit Attach

Modify the code to use the linux curl libraries to deliver data to the Weather Underground Site

Introduction

The current code, which talks to the weather underground site using sockets just upped and stopped working one day. I couldn't see any reason for this,so assume that it's something that's changed on the WU site itself. So I rewrote the relevant functions to use thefreely available curl libraries.

Description of Patch

This is a replacement for the http_request_url function inlinux2300.c, at approx line 245.

Installation of Patch

1. Install the libcurl development support ( redhat: yum install libcurl-devel, debian/ubuntu: apt-get install libcurl4-openssl-dev )

2. Edit the file linux2300.c, and perform the following:

c. line 18:add

#include <curl/curl.h>

after the other system includes.

at c. line 246, replace the function http_request_url with

int http_request_url(char *urlline)
{
CURL *curl;
CURLcode res;

if ( (curl = curl_easy_init()) )
{
curl_easy_setopt ( curl, CURLOPT_URL, urlline );
res = curl_easy_perform ( curl );
curl_easy_cleanup ( curl );
}
return 0;
}

3. Edit the file Makefile, and change the following line

CC_LDFLAGS = -lm

to

CC_LDFLAGS = -lm -lcurl

4. make wu2300 && make install

Change History of Patch

Discussion and Comments


Edit the file linux2300.c, and perform the following:

c. line 18:add

#include <curl/curl.h>

after the other system includes.

at c. line 246, replace the function http_request_url with

int http_request_url(char *urlline)
{
CURL *curl;
CURLcode res;

if ( (curl = curl_easy_init()) )
{
curl_easy_setopt ( curl, CURLOPT_URL, urlline );
res = curl_easy_perform ( curl );
curl_easy_cleanup ( curl );
}
return 0;
}

Edit the file Make file, and change the following line

CC_LDFLAGS = -lm

to

CC_LDFLAGS = -lm -lcurl

Change History of Patch

Discussion and Comments


Topic revision: r1 - 26 Dec 2008, SteveHoldoway
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.