HTTP post and response

Post Reply
User avatar
cdmmaui
Posts: 653
Joined: Fri Oct 28, 2005 9:53 am
Location: The Woodlands - Dallas - Scottsdale - London
Contact:

HTTP post and response

Post by cdmmaui »

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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
User avatar
cdmmaui
Posts: 653
Joined: Fri Oct 28, 2005 9:53 am
Location: The Woodlands - Dallas - Scottsdale - London
Contact:

Post by cdmmaui »

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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
R.F.
Posts: 840
Joined: Thu Oct 13, 2005 7:05 pm

Post by R.F. »

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: Select all

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:
So the final code is this:

Code: Select all

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.
User avatar
cdmmaui
Posts: 653
Joined: Fri Oct 28, 2005 9:53 am
Location: The Woodlands - Dallas - Scottsdale - London
Contact:

Post by cdmmaui »

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
User avatar
cdmmaui
Posts: 653
Joined: Fri Oct 28, 2005 9:53 am
Location: The Woodlands - Dallas - Scottsdale - London
Contact:

Post by cdmmaui »

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
peterfkennedy
Posts: 1
Joined: Fri Nov 12, 2010 9:21 pm

AESWEBLINK

Post by peterfkennedy »

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: Select all

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:
So the final code is this:

Code: Select all

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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: HTTP post and response

Post by James Bott »

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
Post Reply