1、準備pslib21.dll
2、得到http url
3、發送http請求
4、得到返回值
eg:
instance variables:
constant string is_HttpIP = '192.168.0.97'
constant string is_HttpPort = '8080'
//取httpurl
of_gethttp()
string ls_httpurl
ls_httpurl = "http://" + is_HttpIP + ":" + is_HttpPort;
return ls_httpurl
//發送HTTP請求
of_posthttpreq(as_strreqdata, as_strurl)
string ls_Result
OLEObject Header
Header = CREATE OLEobject
if Header.ConnectToNewObject("Dart.DartStrings") < 0 then
MessageBox("Fatal Error","Could not create DartStrings object")
return "false"
end if
ole_Http.object.Url = as_strurl
ole_Http.object.Timeout = 180000
// Post the assembled string
ole_Http.object.Post(as_strreqdata, Header, REF ls_Result)
//錯誤處理
if nError <> 0 then
ls_Result = string(nError) + " : " + sError + ls_Result
if nError = httpTimeout then
MessageBox("錯誤:","網絡超時,請與系統管理員聯繫!")
else
MessageBox("其他錯誤:","Error #" + ls_Result)
end if
end if
return ls_Result