微信開發(二)http請求工具類

2021-08-20 03:38:47 字數 3360 閱讀 7020

}通過對比sendget和sendpost兩種方法,發現不同之處有:

}通過比較這兩種方式,發現在建立請求方法時,對url處理不同,httpget的url直接拼接了引數,而httpget的url不做處理,引數則是通過了urlencodedformentity 物件進行設定

public static string jsonofpost(string url, string param)else

} catch (ioexception e)

return res;

}

關於http的請求總結到這裡,有關於post和get請求的區別,詳見:

參考的優秀博文:

HTTP 請求 工具類

using system using system.collections using system.collections.generic using system.io using system.net using system.text using system.web namespace i...

http請求工具類

簡單的http請求,短連線,請求完成之後就結束了,post請求 用於key value格式的引數 post請求 用於請求json格式的引數 param url param params return public static string dopost string url,string para...

Http網路請求工具類

獲取網路 字串 param address 後台提供的介面 return string public static string getstringfromnet final string address try catch exception e return response.tostring ...