diff --git a/apps/app_curl.c b/apps/app_curl.c
index 558117d088b3bac74fc64db17aaa738b04a171a5..06d387c54f51da5feceabb2d865a6f9053da92da 100755
--- a/apps/app_curl.c
+++ b/apps/app_curl.c
@@ -104,7 +104,11 @@ static int curl_exec(struct ast_channel *chan, void *data)
 
 		curl_easy_setopt(curl, CURLOPT_URL, url);
 		curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
+#ifdef CURLOPT_WRITEDATA
 		curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&chunk);
+#else
+		curl_easy_setopt(curl, CURLOPT_WRITEINFO, (void *)&chunk);
+#endif
 		curl_easy_setopt(curl, CURLOPT_USERAGENT, "asterisk-libcurl-agent/1.0");
 
 		if (post_data) {