Enter text to URL encode or decode
void ocu_url_encode( string * pstrText, BOOL bEncode = TRUE )
EX1
#include <origin.h> #include <ocu.h> void state_search(string strSearch="South Carolina", string strCountry="USA") { //example "http://services.groupkt.com/state/search/IND?text=pradesh" string strURL = "http://services.groupkt.com/state/search/"; strURL += strCountry; strURL += "?text="; ocu_url_encode(&strSearch);//search text might have spaces strURL += strSearch; string result; int err = okutil_http_get(strURL, &result); if( err == 0 ) { Tree tr; JSON.FromString(tr, result); TreeNode trResult = tr.RestResponse; string strRetMsg = trResult.messages._0.strVal; out_str(strRetMsg); if(strRetMsg.Find("No") < 0) out_tree(trResult.result); } else printf("Error %d\n", err); }
ocu.h