diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-19 14:09:04 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-19 14:09:04 +0800 |
commit | d943e6dd7e6971309db8c3ef25132cc69a68a52b (patch) | |
tree | 7bb70603a0803373e1ab2106549c549e752d6cb0 | |
parent | 98fb2f7df3947ecb639e170f00bb156110eb2702 (diff) | |
parent | b24e0bdf48e6e4ec2cab90bec1f4a03d26cdfd50 (diff) |
Merge branch 'master' into sicepat
-rw-r--r-- | anteraja.c | 4 | ||||
-rw-r--r-- | pikul.c | 4 |
2 files changed, 4 insertions, 4 deletions
@@ -50,8 +50,6 @@ #define ORDER_ITEM_PRICE 9 #define ORDER_ITEM_WEIGHT 5 -extern CURL *curl; - static const char *status_trail[] = { "status", NULL }; static char *prefix = NULL; @@ -75,7 +73,6 @@ void anteraja_services(const char *origin, const char *destination, double weigh *post = malloc(strlen(SERVICES_POST) + strlen(origin) + strlen(destination) + SERVICES_WEIGHT - 2 * strlen("%s") - strlen("%d") + 1); sprintf(*post, SERVICES_POST, origin, destination, weight < 1.0 ? 1000 : (int)weight * 1000); - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, *post); } size_t anteraja_services_handle(const char *contents, size_t size, size_t nmemb, @@ -144,7 +141,6 @@ void anteraja_order(const char *order_number, const char *service, const char *s sender_phone, origin, sender_address, sender_postal, receiver_name, receiver_phone, destination, receiver_address, receiver_postal, json, total_weight < 1000.0 ? "true" : "false", subtotal < 1000.0 ? 1000 : (int)subtotal); - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, *post); } size_t anteraja_order_handle(const char *contents, size_t size, size_t nmemb, char **tracking_number) @@ -73,6 +73,8 @@ struct pikul_services *pikul_services(const char *origin, const char *destinatio } curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, handler); + if (post) + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post); curl_easy_perform(curl); if (post) free(post); @@ -144,6 +146,8 @@ char *pikul_order(const char *order_number, const char *service, const char *sen } curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, handler); + if (post) + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, post); curl_easy_perform(curl); if (post) free(post); |