FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour HTTP post and response
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
HTTP post and response
Posted: Wed Dec 27, 2006 02:28 AM

Hello,

I need to post HTML code to a website from FWH and wait for a response from the website. Can you anyone provide an example of how I can accomplish this function. Here is the code I need to post.

Thank you in advance for your help!'

// sample html code -----------------------------

<FORM ACTION="https://www.aesdirect.gov/weblink/weblink.cgi" METHOD="POST">

<INPUT TYPE="HIDDEN" NAME="wl_app_ident" VALUE="APP001"> <INPUT TYPE="HIDDEN" NAME="wl_nologin_url"
VALUE="http://www.weblinktestapp.com/nologin.html">
<INPUT TYPE="HIDDEN" NAME="wl_nosed_url"
VALUE="http://www.weblinktestapp.com/nosed.html">
<INPUT TYPE="HIDDEN" NAME="wl_success_url"
VALUE="http://www.weblinktestapp.com/success.html">

<INPUT TYPE="HIDDEN" NAME="SRN" VALUE="WEBLINKEXAMPLE"> <INPUT TYPE="HIDDEN" NAME="AD1_3" VALUE="TEST CONSIGNEE"> <INPUT TYPE="HIDDEN" NAME="isLine1" VALUE="Y"> <INPUT TYPE="HIDDEN" NAME="IT1_1" VALUE="OS"> <INPUT TYPE="HIDDEN" NAME="IT1_2" VALUE="100000"> <INPUT TYPE="HIDDEN" NAME="IT1_3" VALUE="KG"> <INPUT TYPE="HIDDEN" NAME="IT1_4" VALUE="100"> <INPUT TYPE="HIDDEN" NAME="IT1_7" VALUE="150"> <INPUT TYPE="HIDDEN" NAME="IT1_8" VALUE="C33"> <INPUT TYPE="HIDDEN" NAME="IT1_12" VALUE="ELECTRONIC EQUIPMENT"> <INPUT TYPE="HIDDEN" NAME="IT1_13" VALUE="3505100092"> <INPUT TYPE="HIDDEN" NAME="IT1_15" VALUE="N"> <INPUT TYPE="HIDDEN" NAME="IT1_21" VALUE="D">

</FORM>

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
HTTP post and response
Posted: Thu Dec 28, 2006 12:03 AM
Darrell,

I think maybe you misunderstand how this works. You create the html file on your computer then open it in a browser.

This is from their website.

It is possible for a Windows desktop application to use AESWebLink. In this case, the application could write an html file to the local PC that includes the form to be submitted to AESWebLink and then open the html file in the web browser on the PC. The form can then be submitted to AESWebLink.


James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
HTTP post and response
Posted: Fri Jul 13, 2007 08:13 PM

Hi James,

I need to get the response from the website. Is it possible to retrieve the information in the response?

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
HTTP post and response
Posted: Fri Jul 13, 2007 08:22 PM

Darrell,

I don't know. I have never used this site.

The difficulty is that the response will have a different URL each time. Possibly you could use OLE to get the url from IE, then read the page and strip out the data. Just an idea...

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 840
Joined: Thu Oct 13, 2005 07:05 PM
HTTP post and response
Posted: Sat Jul 14, 2007 12:09 AM
You guys are getting crazy for a thing that can be easly resolved !!!!! don't kill pigeons with cannon balls.

Have you ever heard about TURL class? (comes along with xHarbour), it's very simple to use:

oUrl := tURL():New(<here comes the call to the web page>)
oClient := tIPClient():New( oUrl )
oClient:nConnTimeout := 20000

IF oClient:Open( oUrl )
    oClient:ReadToFile( ".\file_name_with_result_here.whatever" )
    oClient:Close()
ENDIF


and then you just have to replace <here comes the call to the web page> with the URL encoded form of the webpage, that is this:


https://www.aesdirect.gov/weblink/webli ... nosed_url="http://www.weblinktestapp.com/nosed.html&wl_success_url=http://www.weblinktestapp.com/success.html&SRN=WEBLINKEXAMPLE&AD1_3=TEST+CONSIGNEE&isLine1"=Y&IT1_1=OS&IT1_2=100000&IT1_3=KG&IT1_4=100&IT1_7=150&IT1_8E=C33&IT1_12=ELECTRONIC&EQUIPMENT&IT1_13=3505100092&IT1_15=N&IT1_21=D


So the final code is this:

oUrl := tURL():New("https://www.aesdirect.gov/weblink/weblink.cgi?wl_app_ident=APP001&wl_nologin_url=http://www.weblinktestapp.com/nologin.html&wl_nosed_url="http://www.weblinktestapp.com/nosed.html&wl_success_url=http://www.weblinktestapp.com/success.html&SRN=WEBLINKEXAMPLE&AD1_3=TEST+CONSIGNEE&isLine1"=Y&IT1_1=OS&IT1_2=100000&IT1_3=KG&IT1_4=100&IT1_7=150&IT1_8E=C33&IT1_12=ELECTRONIC&EQUIPMENT&IT1_13=3505100092&IT1_15=N&IT1_21=D")
oClient := tIPClient():New( oUrl )
oClient:nConnTimeout := 20000

IF oClient:Open( oUrl )
    oClient:ReadToFile( ".\result.txt" )
    oClient:Close()
ENDIF


I think there's something missing in the URL code (the post method in deed) you have to check the Open Method of the TIPClient class in order to know how to call the POST method
Saludos

R.F.
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
HTTP post and response
Posted: Sat Jul 14, 2007 02:47 AM

Hi Rene,

Thank you for your help. I am getting a harbour exception when trying to run this function. I am linking TIP.LIB dated 01-13-07; is there a new version or do I need to link a different library?

Thank you,

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
HTTP post and response
Posted: Sat Jul 14, 2007 05:38 PM

Hi Rene,

Here is the error I am getting.

HARBOUR EXCEPTION
HB_REGEXCOMP(0)
TURL(85)
_AESSEND(332)
EDITOCN(1470)
EVAL(356)
.
.
.

Can you help? Do you have a new version of TIP.LIB?[/img]

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 1
Joined: Fri Nov 12, 2010 09:21 PM
AESWEBLINK
Posted: Sat Nov 13, 2010 10:53 PM
Rene:

any ready application out there to accomplish submitting our data in a mysql database the the AESWEBLLINK?
Out of the 100 certified aesdirect vendors, some one could have done this 10 times...

Tks..

Peter






R.F. wrote:You guys are getting crazy for a thing that can be easly resolved !!!!! don't kill pigeons with cannon balls.

Have you ever heard about TURL class? (comes along with xHarbour), it's very simple to use:

Code (fw): Select all Collapse
oUrl := tURL():New(<here comes the call to the web page>)
oClient := tIPClient():New( oUrl )
oClient:nConnTimeout := 20000

IF oClient:Open( oUrl )
    oClient:ReadToFile( ".\file_name_with_result_here.whatever" )
    oClient:Close()
ENDIF


and then you just have to replace <here comes the call to the web page> with the URL encoded form of the webpage, that is this:


https://www.aesdirect.gov/weblink/webli ... nosed_url="http://www.weblinktestapp.com/nosed.html&wl_success_url=http://www.weblinktestapp.com/success.html&SRN=WEBLINKEXAMPLE&AD1_3=TEST+CONSIGNEE&isLine1"=Y&IT1_1=OS&IT1_2=100000&IT1_3=KG&IT1_4=100&IT1_7=150&IT1_8E=C33&IT1_12=ELECTRONIC&EQUIPMENT&IT1_13=3505100092&IT1_15=N&IT1_21=D


So the final code is this:

Code (fw): Select all Collapse
oUrl := tURL():New("https://www.aesdirect.gov/weblink/weblink.cgi?wl_app_ident=APP001&wl_nologin_url=http://www.weblinktestapp.com/nologin.html&wl_nosed_url="http://www.weblinktestapp.com/nosed.html&wl_success_url=http://www.weblinktestapp.com/success.html&SRN=WEBLINKEXAMPLE&AD1_3=TEST+CONSIGNEE&isLine1"=Y&IT1_1=OS&IT1_2=100000&IT1_3=KG&IT1_4=100&IT1_7=150&IT1_8E=C33&IT1_12=ELECTRONIC&EQUIPMENT&IT1_13=3505100092&IT1_15=N&IT1_21=D")
oClient := tIPClient():New( oUrl )
oClient:nConnTimeout := 20000

IF oClient:Open( oUrl )
    oClient:ReadToFile( ".\result.txt" )
    oClient:Close()
ENDIF


I think there's something missing in the URL code (the post method in deed) you have to check the Open Method of the TIPClient class in order to know how to call the POST method
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: HTTP post and response
Posted: Thu Nov 18, 2010 08:29 PM
Peter,

I don't know anything about this topic, but I searched for "aesdirect" and the first software that came up says this:

The eLading Documents Software is based on industry standard ODBC technology and can therefore connect to any ODBC compliant database such as Microsoft SQL Server, Sybase SQL Anywhere, etc.


http://www.elading.com/features.aspx

Perhaps that is what you are looking for? I'm not sure if MySQL is ODBC compliant.

Also, I didn't quite understand some of the previous messages in this thread. Is the example code not working?

Regards,
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion