// =-=-=-=-=-=-=- // 1. Write a standard issue microservice int irods_http_send_file( msParam_t* url, msParam_t* src_obj, ruleExecInfo_t* rei ) { dataObjInp_t dataObjInp, *myDataObjInp; char *myUrl; // Sanity checks if ( !rei || !rei->rsComm ) { rodsLog( LOG_ERROR, "irods_http_send_file Input rei or rsComm is NULL." ); return ( SYS_INTERNAL_NULL_INPUT_ERR ); } // Get path of destination object rei->status = parseMspForDataObjInp( src_obj, &dataObjInp, &myDataObjInp, 0 ); if ( rei->status < 0 ) { rodsLog( LOG_ERROR, "irods_http_send_file: Input object error. status = %d", rei->status ); return ( rei->status ); } // Create irodsCurl instance irodsCurl myCurl( rei->rsComm ); // Call irodsCurl::post rei->status = myCurl.post( parseMspForStr( url ), myDataObjInp->objPath ); // Done return rei->status; }
int main() { const int SIZE = 7; std::string list[SIZE]; list[0] = "feed"; list[1] = "entry"; list[2] = "title"; list[3] = "category"; list[4] = "term"; list[5] = "link"; list[6] = "href"; const std::string website = "http://www.reddit.com/.xml"; std::unordered_set<std::string> subs = {"news", "worldnews", "mildlyinteresting", "science", "aww", "space", "AskReddit"}; const std::string to = "recipient_email"; const std::string from = "sender_email"; const std::string from_pass = "******"; const std::string smtp = "senders_email_client"; CurlSetup myCurl(website); ParseXML myXML(myCurl.readBuffer, list, subs); myXML.get_post_attributes(); const std::string content = myXML.linked_post_list.to_string(); CurlEmail myEmail(to, from, from_pass,smtp, content); myEmail.send_mail(); return 0; }