<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Marcus Povey &#187; C</title>
	<atom:link href="http://www.marcus-povey.co.uk/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.marcus-povey.co.uk</link>
	<description>Making the world a better place, one byte at a time...</description>
	<lastBuildDate>Mon, 06 Feb 2012 19:13:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
	<atom:link rel='hub' href='http://www.marcus-povey.co.uk/?pushpress=hub'/>
		<item>
		<title>Latakoo Flight API bindings for Python, PHP, Ruby and .NET</title>
		<link>http://www.marcus-povey.co.uk/2012/01/13/latakoo-flight-api-bindings-for-python-php-and-net/</link>
		<comments>http://www.marcus-povey.co.uk/2012/01/13/latakoo-flight-api-bindings-for-python-php-and-net/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 08:40:00 +0000</pubDate>
		<dc:creator>Marcus Povey</dc:creator>
				<category><![CDATA[Latakoo]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[latakoo]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[mono]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.marcus-povey.co.uk/?p=988</guid>
		<description><![CDATA[I got bored one evening, so I hacked together the beginnings of an API library for latakoo Flight. Currently it&#8217;s available in three four tasty flavours &#8211; PHP, Python, Ruby and C# .NET / Mono. The libraries are minimal but functional; they let you perform both anonymous and authenticated queries against the latakoo API endpoint, [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.marcus-povey.co.uk/wp-content/pythonmonophplatakoo.jpg" align="right" width="200" />I got bored one evening, so I hacked together the beginnings of an API library for <a href="http://latakoo.com">latakoo Flight</a>. Currently it&#8217;s available in <strike>three</strike> four tasty flavours &#8211; <a href="https://github.com/mapkyca/Latakoo-Flight-API-Client/tree/master/php">PHP</a>, <a href="https://github.com/mapkyca/Latakoo-Flight-API-Client/tree/master/python">Python</a>, <a href="https://github.com/mapkyca/Latakoo-Flight-API-Client/tree/master/ruby">Ruby</a> and <a href="https://github.com/mapkyca/Latakoo-Flight-API-Client/tree/master/mono">C# .NET / Mono</a>.</p>
<p>The libraries are minimal but functional; they let you perform both anonymous and authenticated queries against the latakoo API endpoint, but I&#8217;ve only had time to add method wrappers for a few of api calls. Feel free to fork the project to help flesh these out!</p>
<p>Hopefully these libraries will make it easier to get the power of <a href="http://latakoo.com">latakoo</a> behind your project. </p>
<p>Happy hacking!</p>
<p>&raquo; <a href="http://docs.latakoo.com">API Documentation</a><br />
&raquo; <a href="https://github.com/mapkyca/Latakoo-Flight-API-Client">Github Project Page</a></p>
<div class="wsbuttons">
	<div class="shareblob facebook">
		<div class="fb-like" data-href="http://www.marcus-povey.co.uk/2012/01/13/latakoo-flight-api-bindings-for-python-php-and-net/" data-send="false" data-layout="box_count" data-width="60" data-show-faces="false" data-colorscheme="light"></div>
	</div>

	<div class="shareblob google">
		<div class="g-plusone" data-size="tall" data-href="http://www.marcus-povey.co.uk/2012/01/13/latakoo-flight-api-bindings-for-python-php-and-net/"></div>
	</div>

	<div class="shareblob twitter">
		<div class="twitter">
			<a href="https://twitter.com/share?url=http%3A%2F%2Fwww.marcus-povey.co.uk%2F2012%2F01%2F13%2Flatakoo-flight-api-bindings-for-python-php-and-net%2F&count=vertical" class="twitter-share-button" data-lang="en">Tweet</a>
			<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
		</div>
	</div>

</div>
	]]></content:encoded>
			<wfw:commentRss>http://www.marcus-povey.co.uk/2012/01/13/latakoo-flight-api-bindings-for-python-php-and-net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Connecting to elggVoices with C</title>
		<link>http://www.marcus-povey.co.uk/2008/02/28/connecting-to-elggvoices-with-c/</link>
		<comments>http://www.marcus-povey.co.uk/2008/02/28/connecting-to-elggvoices-with-c/#comments</comments>
		<pubDate>Thu, 28 Feb 2008 16:34:52 +0000</pubDate>
		<dc:creator>Marcus Povey</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[elggvoices]]></category>

		<guid isPermaLink="false">http://www.marcus-povey.co.uk/2008/02/28/connecting-to-elggvoices-with-c/</guid>
		<description><![CDATA[The other week I posted a PHP example for connecting to the elggVoices API. For those of you interested in developing desktop applications, here is some example code for doing the same thing in C/C++. This code is designed to be built into a library (either a static or dynamic) but could probably be directly [...]]]></description>
			<content:encoded><![CDATA[<p>The other week I posted a <a href="http://www.marcus-povey.co.uk/2008/02/25/getting-started-with-the-elggvoices-api-part-4-putting-it-all-together/">PHP example for connecting to the elggVoices API</a>. For those of you interested in developing desktop applications, here is some example code for doing the same thing in C/C++.</p>
<p>This code is designed to be built into a library (either a static or dynamic) but could probably be directly included without too much trouble. It is tested and works fine on Linux, but should also build as a Windows DLL without too much trouble. Windows doesn&#8217;t support <code>gettimeofday</code>, so this has been rewritten.</p>
<p>You will also need to install <a href="http://curl.haxx.se/libcurl/">libcurl</a> and <a href="http://www.cryptopp.com/">cryptopp</a>, on Debian/Ubuntu these are apt-gettable.</p>
<p><strong>searunner.h</strong></p>
<blockquote><p><code>/**<br />
* @file searunner.h Searunner C++ Client library.<br />
* This is the main include file for the Linux/Win32 client api for the<br />
* searunner social networking platform.<br />
* @author Marcus Povey &lt;marcus@dushka.co.uk&gt;<br />
*/<br />
#ifndef SEARUNNER_H_<br />
#define SEARUNNER_H_</code></p>
<p><code>/** Some definitions */<br />
#define VERSION     "0.1.0"</code></p>
<p><code>#ifdef WIN32<br />
// Windows Only</code></p>
<p><code>#ifdef LIBSEARUNNERW32_EXPORTS<br />
#define LIBSEARUNNERW32_API __declspec(dllexport)<br />
#else<br />
#define LIBSEARUNNERW32_API __declspec(dllimport)<br />
#endif</code></p>
<p><code>#include &lt;winsock2.h&gt;</code></p>
<p><code>// Map snprintf to _snprintf<br />
#define snprintf _snprintf</code></p>
<p><code>#endif</code></p>
<p><code>#ifdef LINUX<br />
// Linux</code></p>
<p><code>#define LIBSEARUNNERW32_API</code></p>
<p><code>#include &lt;sys/types.h&gt;<br />
#include &lt;sys/socket.h&gt;<br />
#include &lt;sys/time.h&gt;<br />
#include &lt;netinet/in.h&gt;<br />
#include &lt;unistd.h&gt;<br />
#include &lt;netdb.h&gt;</code></p>
<p><code>#endif</code></p>
<p><code>/* Include crypto++ lib from www.cryptopp.com */<br />
#include &lt;crypto++/cryptlib.h&gt;</code></p>
<p><code>/**<br />
* Create the configuration structure.<br />
*/<br />
typedef struct {<br />
char apikey[33];<br />
char secret[33];<br />
char endpoint[255];<br />
char hmac_algo[8];<br />
char hash_algo[8];<br />
} SearunnerConfig;</code><br />
<code><br />
extern LIBSEARUNNERW32_API SearunnerConfig hSearunnerConfig;</code></p>
<p><code>/** Get call */<br />
#define SEARUNNER_CALLMODE_GET         0<br />
/** Post call */<br />
#define SEARUNNER_CALLMODE_POST        1</code></p>
<p><code>/** CURL Write function callback type */<br />
typedef size_t (*CURLOPT_WRITEFUNCTION_CALLBACK)( void *ptr, size_t size, size_t nmemb, void *stream);</code></p>
<p><code>/**<br />
* Initialisation the API client.<br />
* This function initialises the api client configuration structure ready for use.<br />
* @param api_key The API key you have been provided with.<br />
* @param secret The secret key you have been provided with.<br />
* @param endpoint_url The API Endpoint.<br />
*/<br />
LIBSEARUNNERW32_API int searunner_initialise_api(const char * api_key, const char * secret, const char * endpoint_url);</code></p>
<p><code>/**<br />
* Raw POST request.<br />
* @param parameters List of parameters.<br />
* @param postData Optional post data in post call or null if this is a GET call.<br />
* @param postdata_length The length of the data being sent.<br />
* @param content_type Optional content type or null if this is a GET call.<br />
* @param buffer The buffer to write the result into [OUT]<br />
* @param buffer_size The size of the buffer<br />
* @return The amount actually written.<br />
*/<br />
LIBSEARUNNERW32_API int __searunner_post_call(const char * parameters, unsigned char * postData, int postdata_length, char * content_type, CURLOPT_WRITEFUNCTION_CALLBACK curl_read_func);</code></p>
<p><code>/**<br />
* Raw GET request.<br />
* @param parameters List of parameters.<br />
* @param buffer The buffer to write the result into [OUT]<br />
* @param buffer_size The size of the buffer<br />
* @return The amount actually written.<br />
*/<br />
LIBSEARUNNERW32_API int __searunner_get_call(const char * parameters, CURLOPT_WRITEFUNCTION_CALLBACK curl_read_func);</code></p>
<p><code>/**<br />
* Make a searunner call.<br />
* @param method Method call.<br />
* @param parameters List of parameters.<br />
* @param postData Optional post data in post call or null if this is a GET call.<br />
* @param postdata_length The length of the data being sent.<br />
* @param content_type Optional content type or null if this is a GET call.<br />
* @param buffer The buffer to write the result into [OUT]<br />
* @param buffer_size The size of the buffer<br />
* @return The amount actually written.<br />
*/<br />
LIBSEARUNNERW32_API int __searunner_call(int method, const char * parameters, unsigned char * postData, int postdata_length, char * content_type, CURLOPT_WRITEFUNCTION_CALLBACK curl_read_func);</code></p>
<p><code>#endif /*SEARUNNER_H_*/</code></p></blockquote>
<p><strong>searunner.cpp</strong></p>
<blockquote><p> <code>/**<br />
* @file searunner.cpp<br />
* Main functions and Win32 DLL entrypoint.<br />
* @author Marcus Povey &lt;marcus@dushka.co.uk&gt;<br />
*/</code></p>
<p><code>#include "searunner.h"<br />
#include &lt;stdio.h&gt;<br />
#include &lt;stdlib.h&gt;<br />
#include &lt;string.h&gt;<br />
#include &lt;crypto++/sha.h&gt;<br />
#include &lt;crypto++/hmac.h&gt;<br />
#include &lt;crypto++/hex.h&gt;<br />
#include &lt;crypto++/filters.h&gt;<br />
#include &lt;curl/curl.h&gt;<br />
#include &lt;time.h&gt;<br />
</code></p>
<p><code>/* Configuration structure */<br />
LIBSEARUNNERW32_API SearunnerConfig hSearunnerConfig;</code></p>
<p><code>/* Utility functions used internally */<br />
#ifdef WIN32</code></p>
<p><code>#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)<br />
#define DELTA_EPOCH_IN_MICROSECS  11644473600000000Ui64<br />
#else<br />
#define DELTA_EPOCH_IN_MICROSECS  11644473600000000ULL<br />
#endif</code></p>
<p><code>struct timezone<br />
{<br />
int  tz_minuteswest; /* minutes W of Greenwich */<br />
int  tz_dsttime;     /* type of dst correction */<br />
};</code></p>
<p><code>/**<br />
* Replacement gettimeofday function for windows.<br />
* Obtained from http://www.openasthra.com/c-tidbits/gettimeofday-function-for-windows/<br />
*/<br />
int gettimeofday(struct timeval *tv, struct timezone *tz)<br />
{<br />
FILETIME ft;<br />
unsigned __int64 tmpres = 0;<br />
static int tzflag;</code></p>
<p><code>if (NULL != tv)<br />
{<br />
GetSystemTimeAsFileTime(&amp;ft);</code></p>
<p><code>tmpres |= ft.dwHighDateTime;<br />
tmpres &lt;&lt;= 32;<br />
tmpres |= ft.dwLowDateTime;</code></p>
<p><code>/*converting file time to unix epoch*/<br />
tmpres /= 10;  /*convert into microseconds*/<br />
tmpres -= DELTA_EPOCH_IN_MICROSECS;<br />
tv-&gt;tv_sec = (long)(tmpres / 1000000UL);<br />
tv-&gt;tv_usec = (long)(tmpres % 1000000UL);<br />
}</code></p>
<p><code>if (NULL != tz)<br />
{<br />
if (!tzflag)<br />
{<br />
_tzset();<br />
tzflag++;<br />
}<br />
tz-&gt;tz_minuteswest = _timezone / 60;<br />
tz-&gt;tz_dsttime = _daylight;<br />
}</code></p>
<p><code>return 0;<br />
}</code></p>
<p><code>#endif</code></p>
<p><code>#define MICRO_IN_SEC 1000000.00</code></p>
<p><code>/**<br />
* Micro time function.<br />
*<br />
* Example usage:<br />
*<br />
* char oo[100];<br />
* microtime(oo);<br />
* printf(oo);<br />
*<br />
* @param buffer Where to output variables.<br />
*/<br />
int microtime(char * buffer)<br />
{<br />
struct timeval tp;<br />
long sec = 0L;<br />
double msec = 0.0;<br />
char ret[100];</code></p>
<p><code>if (gettimeofday((struct timeval *) &amp;tp, (NULL)) == 0)<br />
{<br />
msec = (double) (tp.tv_usec / MICRO_IN_SEC);<br />
sec = tp.tv_sec;</code></p>
<p><code>if (msec &gt;= 1.0) msec -= (long) msec;</code><br />
<code><br />
int msec2 = (int)(msec*100);</code></p>
<p><code>snprintf(ret, 100, "%ld.%d",  sec, msec2);<br />
strcpy(buffer, ret);<br />
return 0;<br />
}</code></p>
<p><code>return -1;<br />
}</code></p>
<p><code>/**<br />
* Calculate a hmac for the given data.<br />
*<br />
* Example usage:<br />
*<br />
* char oo [2*CryptoPP::SHA1::DIGESTSIZE+1];<br />
* calculate_hmac(&amp;hSearunnerConfig, "1", "2", "3", oo, 2*CryptoPP::SHA1::DIGESTSIZE+1);<br />
* printf(oo);<br />
*<br />
* @param time String representation of time<br />
* @param get_variables String of parameters<br />
* @param post_hash The hash<br />
* @param buffer The buffer<br />
* @param bugger_size Size of the buffer<br />
*/<br />
int calculate_hmac(<br />
const char * time,<br />
const char * get_variables,<br />
const char * post_hash,</code></p>
<p><code>char * buffer, int buffer_size)<br />
{<br />
memset(buffer,0,buffer_size);</code></p>
<p><code>if (strcmp(hSearunnerConfig.hmac_algo, "sha1")==0)<br />
{<br />
// Sha1</code></p>
<p><code>// Check the buffer size before we do anything<br />
if (buffer_size&lt;2*CryptoPP::SHA1::DIGESTSIZE + 1) return -1;</code></p>
<p><code>// Initialise memory<br />
unsigned char tmp[ 2*CryptoPP::SHA1::DIGESTSIZE + 1 ];<br />
memset(tmp,0,2*CryptoPP::SHA1::DIGESTSIZE + 1);</code></p>
<p><code>// Compute HMAC<br />
CryptoPP::HMAC&lt;CryptoPP::SHA1&gt; hmac((const byte*)hSearunnerConfig.secret, strlen(hSearunnerConfig.secret));<br />
hmac.Update((const byte*)time, strlen(time));<br />
hmac.Update((const byte*)hSearunnerConfig.apikey, strlen(hSearunnerConfig.apikey));<br />
hmac.Update((const byte*)get_variables, strlen(get_variables));<br />
if (post_hash) hmac.Update((const byte*)post_hash, strlen(post_hash));</code></p>
<p><code>hmac.Final((byte*)tmp);</code></p>
<p><code>// hex encode<br />
CryptoPP::HexEncoder encoder;<br />
encoder.Attach(new CryptoPP::ArraySink((byte*)buffer, 2*CryptoPP::SHA1::DIGESTSIZE));<br />
encoder.Put(tmp, sizeof(tmp));<br />
encoder.MessageEnd();</code></p>
<p><code>// Convert to lower case<br />
for (int n = 0; n&lt;buffer_size; n++)<br />
if (buffer[n]!=0) buffer[n] = tolower(buffer[n]);</code></p>
<p><code>return 0;<br />
}</code></p>
<p><code>return -1;<br />
}</code></p>
<p><code>/*<br />
* Calculate the hash of some POST data.<br />
* TODO: Tidy this up<br />
* TODO: Support more algorithms<br />
*<br />
* Example usage:<br />
*<br />
* char oo [2*CryptoPP::MD5::DIGESTSIZE+1];<br />
* calculate_POST_hash(&amp;hSearunnerConfig, (unsigned char*)"test", 4, oo, 2*CryptoPP::MD5::DIGESTSIZE+1);<br />
* printf(oo);<br />
*<br />
* @param postdata The data<br />
* @param postlength The length<br />
* @param outputbuffer The buffer<br />
* @param outputbuffer_size The size of the output buffer<br />
*/<br />
int calculate_POST_hash(const unsigned char * postdata, int postlength, char * outputbuffer, int outputbuffer_size)<br />
{<br />
memset(outputbuffer,0,outputbuffer_size);</code></p>
<p><code>if (strcmp(hSearunnerConfig.hash_algo, "sha1")==0)<br />
{<br />
// Check the buffer size before we do anything<br />
if (outputbuffer_size&lt;2*CryptoPP::SHA1::DIGESTSIZE + 1) return -1;</code><br />
<code><br />
// Initialise memory<br />
unsigned char tmp[ 2*CryptoPP::SHA1::DIGESTSIZE + 1 ];<br />
memset(tmp,0,2*CryptoPP::SHA1::DIGESTSIZE + 1);</code></p>
<p><code>// Calculate the digest<br />
CryptoPP::SHA1 hash;<br />
hash.CalculateDigest((byte*)tmp, (const byte*)postdata, postlength);</code></p>
<p><code>// hex encode<br />
CryptoPP::HexEncoder encoder;<br />
encoder.Attach(new CryptoPP::ArraySink((byte*)outputbuffer, 2*CryptoPP::SHA1::DIGESTSIZE));<br />
encoder.Put(tmp, sizeof(tmp));<br />
encoder.MessageEnd();</code></p>
<p><code>// Convert to lower case<br />
for (int n = 0; n&lt;outputbuffer_size; n++)<br />
if (outputbuffer[n]!=0) outputbuffer[n] = tolower(outputbuffer[n]);</code></p>
<p><code>return 0;<br />
}</code></p>
<p><code>return -1;<br />
}</code></p>
<p><code>/*************************************/</code></p>
<p><code>LIBSEARUNNERW32_API int searunner_initialise_api(const char * api_key, const char * secret, const char * endpoint_url)<br />
{<br />
strcpy(hSearunnerConfig.apikey, api_key);<br />
strcpy(hSearunnerConfig.secret, secret);<br />
strcpy(hSearunnerConfig.endpoint, endpoint_url);<br />
strcpy(hSearunnerConfig.hmac_algo, "sha1");<br />
strcpy(hSearunnerConfig.hash_algo, "sha1");<br />
return 0;<br />
}</code></p>
<p><code>LIBSEARUNNERW32_API int __searunner_call(int method,<br />
const char * parameters,<br />
unsigned char * postData,<br />
int postdata_length,<br />
char * content_type,<br />
CURLOPT_WRITEFUNCTION_CALLBACK curl_read_func)<br />
{<br />
char url[2048] = {""};<br />
char posthash[256] = {""};<br />
char hmac[256] = {""};<br />
char tmp[100] = {""};</code></p>
<p><code>struct curl_slist *headerlist = NULL;</code></p>
<p><code>// Get the microtime for now<br />
char time[100];<br />
microtime(time);</code></p>
<p><code>// Construct URL<br />
strcpy(url, hSearunnerConfig.endpoint);<br />
strcat(url, "?");<br />
strcat(url, parameters);</code></p>
<p><code>// If post data, hash it<br />
if (postdata_length &gt; 0)<br />
calculate_POST_hash(postData, postdata_length, posthash, 256);</code></p>
<p><code>// Constract the hmac<br />
calculate_hmac(time, parameters, posthash, hmac, 256);</code></p>
<p><code>// Initialise CURL<br />
CURL * curl = curl_easy_init();<br />
if(curl) {</code></p>
<p><code>// Set headers<br />
sprintf(tmp, "X-Searunner-apikey: %s", hSearunnerConfig.apikey);<br />
headerlist = curl_slist_append(headerlist, tmp);</code></p>
<p><code>sprintf(tmp, "X-Searunner-time: %s", time);<br />
headerlist = curl_slist_append(headerlist, tmp);</code></p>
<p><code>sprintf(tmp, "X-Searunner-hmac-algo: %s", hSearunnerConfig.hmac_algo);<br />
headerlist = curl_slist_append(headerlist, tmp);</code></p>
<p><code>sprintf(tmp, "X-Searunner-hmac: %s", hmac);<br />
headerlist = curl_slist_append(headerlist, tmp);</code></p>
<p><code>// Set options<br />
if (method == SEARUNNER_CALLMODE_POST)<br />
{<br />
curl_easy_setopt(curl, CURLOPT_POST, 1); // Use POST</code></p>
<p>s<code>printf(tmp, "X-Searunner-posthash: %s", posthash);<br />
headerlist = curl_slist_append(headerlist, tmp);</code></p>
<p><code>sprintf(tmp, "X-Searunner-posthash-algo: %s", hSearunnerConfig.hash_algo);<br />
headerlist = curl_slist_append(headerlist, tmp);</code></p>
<p><code>sprintf(tmp, "Content-type: %s", content_type);<br />
headerlist = curl_slist_append(headerlist, tmp);</code></p>
<p><code>sprintf(tmp, "Content-Length: %d", postdata_length);<br />
headerlist = curl_slist_append(headerlist, tmp);</code></p>
<p><code>curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postData); // Set the post data<br />
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, postdata_length);<br />
}</code></p>
<p><code>curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist); // Set the headers<br />
curl_easy_setopt(curl,CURLOPT_URL, url); // Set the url<br />
curl_easy_setopt(curl, CURLOPT_READFUNCTION, curl_read_func); // Use our own read function</code></p>
<p><code>// Make call<br />
CURLcode res = curl_easy_perform(curl);</code></p>
<p><code>// Clean up<br />
curl_easy_cleanup(curl);</code></p>
<p><code>return res;<br />
}</code></p>
<p><code>return 0;<br />
}</code></p>
<p><code>LIBSEARUNNERW32_API int __searunner_post_call(const char * parameters, unsigned char * postData, int postdata_length, char * content_type, CURLOPT_WRITEFUNCTION_CALLBACK curl_read_func)<br />
{<br />
return __searunner_call(SEARUNNER_CALLMODE_POST, parameters, postData, postdata_length, content_type, curl_read_func);<br />
}</code></p>
<p><code>LIBSEARUNNERW32_API int __searunner_get_call(const char * parameters, CURLOPT_WRITEFUNCTION_CALLBACK curl_read_func)<br />
{<br />
return __searunner_call(SEARUNNER_CALLMODE_GET, parameters, NULL, 0,  NULL, curl_read_func);<br />
}</code></p>
<p><code>#ifdef WIN32</code></p>
<p><code>/*<br />
Windows Only DLL entrypoint.<br />
*/</code></p>
<p><code>BOOL APIENTRY DllMain( HANDLE hModule,<br />
DWORD  ul_reason_for_call,<br />
LPVOID lpReserved<br />
)<br />
{<br />
switch (ul_reason_for_call)<br />
{<br />
case DLL_PROCESS_ATTACH:<br />
case DLL_THREAD_ATTACH:<br />
case DLL_THREAD_DETACH:<br />
case DLL_PROCESS_DETACH:<br />
break;<br />
}<br />
return TRUE;<br />
}</code><br />
<code><br />
#endif</code></p></blockquote>
<div class="wsbuttons">
	<div class="shareblob facebook">
		<div class="fb-like" data-href="http://www.marcus-povey.co.uk/2008/02/28/connecting-to-elggvoices-with-c/" data-send="false" data-layout="box_count" data-width="60" data-show-faces="false" data-colorscheme="light"></div>
	</div>

	<div class="shareblob google">
		<div class="g-plusone" data-size="tall" data-href="http://www.marcus-povey.co.uk/2008/02/28/connecting-to-elggvoices-with-c/"></div>
	</div>

	<div class="shareblob twitter">
		<div class="twitter">
			<a href="https://twitter.com/share?url=http%3A%2F%2Fwww.marcus-povey.co.uk%2F2008%2F02%2F28%2Fconnecting-to-elggvoices-with-c%2F&count=vertical" class="twitter-share-button" data-lang="en">Tweet</a>
			<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
		</div>
	</div>

</div>
	]]></content:encoded>
			<wfw:commentRss>http://www.marcus-povey.co.uk/2008/02/28/connecting-to-elggvoices-with-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

