Home > database >  Each master, could you tell me who have pb call HTTP examples? Thank you for your help
Each master, could you tell me who have pb call HTTP examples? Thank you for your help

Time:09-19

Each master, could you tell me who have pb call HTTP examples? Thank you for your help

CodePudding user response:

PostURL ()
HTTP Post function, so the original concept application can through the CGI, NSAPI, ISAPI interface sends a request,
Grammar servicereference becomes unavailable but PostURL (urlname urldata, headers, data)
Parameter
Servicereference becomes unavailable but: Inet object instance or reference
Urlname: String type, designated to send the request URL (uniform resource locator)
Urldata: Blob, sent to the specified urlname parameters specify the URL of the
Headers: String type, specify the HTML first, for Netscape browser, need a newline after each HTTP header (~ n), after all first and then with a newline (~ n)
Data: InternetResult instance variables, used to hold the returned HTML
The return value
Integer, the function returns 1 on success, return the following error values:
1 general error
2 the URL specified is invalid
- 4 cannot be connected to the Internet
- 6 Internet request invalid
Use the
Data parameters of the function requirement is class user object inherited InternetResult object instance, in the definition of the user object, you need to define InternetData cover function (), to deal with the Internet returns HTML data, because of the Internet to asynchronously send data, therefore, the data parameter must be an instance variable or a global variable reference (such as window class instance variables),
Example the following code to invoke PostURL (), among them, the Iinet_base is a type of Inet instance variables; N_ir_msgbox is the class user object inherited InternetResult object, iir_msgbox is the user object is an instance:
Blob lblb_args
String ls_headers
String ls_url
Long ll_length
Ir_msgbox=CREATE n_ir_msgbox
Ls_url="http://coltrane.sybase.com/"
Ls_url +="cgi - bin/pbcgi60. Exe/"
Ls_url +="myapp/n_cst_html/f_test? "
Lblb_args=blob (" ")
Ll_length=Len (lblb_args)
Ls_headers="Content - Length:" + String (ll_length) + "~ n ~ n
"Iinet_base. PostURL (ls_url lblb_args, ls_headers, iir_msgbox)

CodePudding user response:

GetUrl can also

Take a look at the help of PB

CodePudding user response:

The PB by inet PostURL method
Global type demo_f_posturl from function_object
End type

Forward as
Global function integer demo_f_posturl (string as_url, string as_args, ref string as_result)
End as

Global function integer demo_f_posturl (string as_url, string as_args, ref string as_result); The Integer li_rc
String ls_header
Blob lblb_args
Demo_n_inet lnv_inet
Demo_n_internetresult lnv_data//internetresult instance of the

If IsNull (as_url) Or as_url="' Then Return 1

Lnv_inet=Create demo_n_inet
Lnv_data demo_n_internetresult=https://bbs.csdn.net/topics/Create

Lblb_args=Blob (as_args EncodingUTF8!) ;
Ls_header="content-type:" + "application/x - WWW - form - urlencoded ~ n" + "Content - Length:" + String (len (lblb_args)) + "~ n ~ n";

//as_url=http://192.168.0.157:9009/test.do
Li_rc=lnv_inet. PostURL (as_url lblb_args, ls_header, lnv_data);

As_result=String (lnv_data ResultData EncodingUTF8!)//ResultData to return the result of data

Destroy lnv_data
Destroy lnv_inet

Return li_rc

End the function

CodePudding user response:

PB to do this is not strong

CodePudding user response:

Didn't understand what those words mean:

 lblb_args=blob (" ") 
Ll_length=Len (lblb_args)




reference 1st floor lzp_lrp response:
PostURL ()
HTTP Post function, so the original concept application can through the CGI, NSAPI, ISAPI interface sends a request,
Grammar servicereference becomes unavailable but PostURL (urlname urldata, headers, data)
Parameter
Servicereference becomes unavailable but: Inet object instance or reference
Urlname: String type, designated to send the request URL (uniform resource locator)
Urldata: Blob, sent to the specified urlname parameters specify the URL of the
Headers: String type, specify the HTML first, for Netscape browser, need a newline after each HTTP header (~ n), after all first and then with a newline (~ n)
Data: InternetResult instance variables, used to hold the returned HTML
The return value
Integer, the function returns 1 on success, return the following error values:
1 general error
2 the URL specified is invalid
- 4 cannot be connected to the Internet
- 6 Internet request invalid
Use the
Data parameters of the function requirement is class user object inherited InternetResult object instance, in the definition of the user object, you need to define InternetData cover function (), to deal with the Internet returns HTML data, because of the Internet to asynchronously send data, therefore, the data parameter must be an instance variable or a global variable reference (such as window class instance variables),
Example the following code to invoke PostURL (), among them, the Iinet_base is a type of Inet instance variables; N_ir_msgbox is the class user object inherited InternetResult object, iir_msgbox is the user object is an instance:
Blob lblb_args
String ls_headers
String ls_url
Long ll_length
Ir_msgbox=CREATE n_ir_msgbox
Ls_url="http://coltrane.sybase.com/"
Ls_url +="cgi - bin/pbcgi60. Exe/"
Ls_url +="myapp/n_cst_html/f_test? "
Lblb_args=blob (" ")
Ll_length=Len (lblb_args)
Ls_headers="Content - Length:" + String (ll_length) + "~ n ~ n
"Iinet_base. PostURL (ls_url lblb_args, ls_headers, iir_msgbox)

CodePudding user response:

reference 5 floor jiang396 reply:
hasn't been clear what those words mean:

 lblb_args=blob (" ") 
Ll_length=Len (lblb_args)


Need an empty blob data as the body of the HTTP

The second sentence, you need to length, wrote in the header

CodePudding user response:

refer to 7th floor lzp_lrp response:
Quote: refer to fifth floor jiang396 response:

Didn't understand what those words mean:

 lblb_args=blob (" ") 
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related