edited some pointer references
This commit is contained in:
		@@ -3,14 +3,14 @@
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
#include "API.h"
 | 
			
		||||
#include "Hashmap.h"
 | 
			
		||||
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <iostream>
 | 
			
		||||
 | 
			
		||||
#include "curl/curl.h"
 | 
			
		||||
#include <sstream>
 | 
			
		||||
 | 
			
		||||
#include "Hashmap.h"
 | 
			
		||||
#include <curl/curl.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
std::string API::request(std::string myurl) {
 | 
			
		||||
    Hashmap<std::string,std::string> map;
 | 
			
		||||
@@ -19,7 +19,7 @@ std::string API::request(std::string myurl) {
 | 
			
		||||
    return request(myurl,false,map,str);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::string API::request(std::string myurl, bool post, Hashmap<std::string,std::string> &map, std::vector<std::string> headers) {
 | 
			
		||||
std::string API::request(std::string myurl, bool post, Hashmap<std::string,std::string> &map, std::vector<std::string> &headers) {
 | 
			
		||||
    CURL *curl;
 | 
			
		||||
    CURLcode res;
 | 
			
		||||
 | 
			
		||||
@@ -52,7 +52,6 @@ std::string API::request(std::string myurl, bool post, Hashmap<std::string,std::
 | 
			
		||||
            }
 | 
			
		||||
            poststring << "}";
 | 
			
		||||
 | 
			
		||||
//            std::cout << "post string: " << poststring.str() << "\n";
 | 
			
		||||
            curl_easy_setopt(curl, CURLOPT_POST, 1);
 | 
			
		||||
            curl_easy_setopt(curl, CURLOPT_COPYPOSTFIELDS, poststring.str().c_str());
 | 
			
		||||
        }else{
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@
 | 
			
		||||
class API {
 | 
			
		||||
public:
 | 
			
		||||
    std::string request(std::string myurl);
 | 
			
		||||
    std::string request(std::string myurl, bool post, Hashmap<std::string,std::string> &map,std::vector<std::string> headers);
 | 
			
		||||
    std::string request(std::string myurl, bool post, Hashmap<std::string,std::string> &map,std::vector<std::string> &headers);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    static size_t write_data(void *buffer, size_t size, size_t buffersize, FILE *stream);
 | 
			
		||||
 
 | 
			
		||||
@@ -21,9 +21,9 @@ int main() {
 | 
			
		||||
 | 
			
		||||
        if(oldip == ip){
 | 
			
		||||
            std::cout << "no change -- ip: " << ip << std::endl;
 | 
			
		||||
            logger.logToLogfile("no change -- ip: "+ip);
 | 
			
		||||
            logger.logToLogfile(" [INFO] no change -- ip: "+ip);
 | 
			
		||||
        } else{
 | 
			
		||||
            logger.logToLogfile("ip changed! -- from :" + oldip + "to: "+ip);
 | 
			
		||||
            logger.logToLogfile(" [INFO] ip changed! -- from :" + oldip + "to: "+ip);
 | 
			
		||||
            std::cout << "ip changed! -- from :" << oldip << "to: " << ip << std::endl;
 | 
			
		||||
 | 
			
		||||
            //api key: 88vNpMfDhMM2YYDNfWR1DNYfRX9W6fYg
 | 
			
		||||
@@ -40,7 +40,7 @@ int main() {
 | 
			
		||||
 | 
			
		||||
            std::string dynurepl = api.request("https://api.dynu.com/v2/dns/8506047",true, args,headers);
 | 
			
		||||
 | 
			
		||||
            std::cout << "---" << dynurepl << std::endl;
 | 
			
		||||
            std::cout << "[ DEBUG ] api reply:: " << dynurepl << std::endl;
 | 
			
		||||
 | 
			
		||||
            if (dynurepl != "{\"statusCode\":200}"){
 | 
			
		||||
                logger.logToLogfile(" [ERROR] failed to write ip to dynu api!");
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user