| Home | Previous Lesson: Course 3:: Session 29 :: Page 210 Next Lesson: Course 3:: Session 29 :: Page 230 |
Displaying HTML page from PowerBuilder using HTML Post method
In the previous section, you have learned to fire the
HTTP GET method. In this example, you will learn to fire HTTP POST method. The following code demonstrates accessing this site's home page using the POST method.// Object: cb_post CommandButton in w_context window
// Library: product_web.pbl
// Event: Clicked
String ls_Headers, ls_URL
Long ll_Length
Inet iinet_1
Blob lblob_args
nc_internet_results
iir_Results1 This code is similar to the A very important thing to note in the above code is that you should put two new line
characters after the 'Content-Length' header line. That's why you see two "~n"
characters. Its basically the empty line after the HTML headers. Without those new
line characters, you will get Web server error and the error number might vary between
different web servers. Our site doesnt support ls_URL= "http://www.applied-software.com/index.cgi" Replace the above two lines with the following two lines in the above code example:
ls_URL= "http://www.applied-software.com/index.cgi" The above code is searching for keywords 'CPD' and 'PowerBuilder'. Its equivalent
of typing 'CPD PowerBuilder' at '
This.GetContextService("Internet", iinet_1 )
iir_Results1 = CREATE nc_internet_results
ls_URL= "http://www.applied-software.com/index.cgi"
lblob_args = Blob("")
ll_Length = Len(lblob_args)
ls_Headers = "Content-Length: " + String(ll_Length) + "~n~n"
iinet_1.PostURL( ls_URL, lblob_args, ls_Headers, iir_Results1 )
lblob_args = Blob("")
lblob_args = Blob("p=CPD+PowerBuilder")
| Home | Previous Lesson: Course 3:: Session 29 :: Page 210 Next Lesson: Course 3:: Session 29 :: Page 230 |