做个速记,以百度搜索为例。
void EncodePlainToURL(char *original, const char * output_param_name) { //将字符串编码转为UTF-8 lr_convert_string_encoding(original, LR_ENC_SYSTEM_LOCALE, LR_ENC_UTF8, "strUTF8"); //去掉C数组后面的null终止符 lr_save_string(lr_eval_string("{strUTF8}"), output_param_name); //将UTF-8字符串URL encode web_convert_param(output_param_name, "SourceEncoding=PLAIN", "TargetEncoding=URL", LAST); } Action() { lr_output_message("******keyword: %s", lr_eval_string("{keyword}")); EncodePlainToURL(lr_eval_string("{keyword}"), "newKeyWord"); lr_output_message("***newKeyWord: %s", lr_eval_string("{newKeyWord}")); web_url("s", "URL=http://www.baidu.com/s?wd={newKeyWord}&rsv_bp=0&rsv_spt=3&ie=utf-8&rsv_sug3=4&inputT=826", "Resource=0", "RecContentType=text/html", "Referer=http://www.baidu.com/", "Snapshot=t2.inf", "Mode=HTML", EXTRARES, LAST); return 0; }
*** walker ***
原创文章,作者:3628473679,如若转载,请注明出处:https://blog.ytso.com/196431.html