473,403 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Calling URL and getting data back in. Use ADODB.Stream????

Hi All,

I am creating an interface into a Payment Gateway. I need to access a
URL (which is a perl script) with paramters attached. I will then get
a response within 10 seconds with information I need to formulate into
my pretty asp page.

I didn't know where to start but I have read alot about adodb.stream.
I setout to write some code and this is what I have done:

Set objStm = Server.CreateObject("ADODB.Stream")
objStm.Type = adTypeText
objStm.Open "URL=" & theurl, admoderead, 8
objStm.Charset = "ascii"
strText = objStm.ReadText
Response.Write strText

theURL variable contains the URL with the payment parameters.

On the open line however, I get an error c004800a. What the hell this
means I don't know. It doesn't matter what I put into theURL even if
it is something like www.yahoo.com, I still get the same error....

Ok, I read an interesting post about using XMLHTTP. I created the code
as follows:

Dim xmlhttp
Set xmlhttp = Server.CreateObject("MSXML2.XMLHTTP")
xmlhttp.Open "GET", theURL, false
xmlhttp.Send
Response.write xmlhttp.responseText

This seems to work very well. I actually got an error back from the
payment gateway stating NO PARAMETERS SUPPLIED. Realising this, I used
a POST rather than GET. Doing this I got FAILED NEED LOGIN although
the Login information was passed as two of the parameters in the URL.
I am doing a response.write of theURL so i know that is is filled with
the correct information. I couldnt find out what the false was for, so
I changed that to true, and got this error: The data necessary to
complete this operation is not yet available.

I am so lost, is there anyone that might have ideas on how to get the
above working. If I just put the URL into the browser, if works OK, so
I know the syntax of theURL is fine.

Thanks for your time,
Robert
Jul 19 '05 #1
7 13028
If it's post, you should pass the information in post variables, not in the
URL. See http://www.aspfaq.com/2173 for some examples.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Robert Brown" <rb****@edium.com> wrote in message
news:bd*************************@posting.google.co m...
Hi All,

I am creating an interface into a Payment Gateway. I need to access a
URL (which is a perl script) with paramters attached. I will then get
a response within 10 seconds with information I need to formulate into
my pretty asp page.

I didn't know where to start but I have read alot about adodb.stream.
I setout to write some code and this is what I have done:

Set objStm = Server.CreateObject("ADODB.Stream")
objStm.Type = adTypeText
objStm.Open "URL=" & theurl, admoderead, 8
objStm.Charset = "ascii"
strText = objStm.ReadText
Response.Write strText

theURL variable contains the URL with the payment parameters.

On the open line however, I get an error c004800a. What the hell this
means I don't know. It doesn't matter what I put into theURL even if
it is something like www.yahoo.com, I still get the same error....

Ok, I read an interesting post about using XMLHTTP. I created the code
as follows:

Dim xmlhttp
Set xmlhttp = Server.CreateObject("MSXML2.XMLHTTP")
xmlhttp.Open "GET", theURL, false
xmlhttp.Send
Response.write xmlhttp.responseText

This seems to work very well. I actually got an error back from the
payment gateway stating NO PARAMETERS SUPPLIED. Realising this, I used
a POST rather than GET. Doing this I got FAILED NEED LOGIN although
the Login information was passed as two of the parameters in the URL.
I am doing a response.write of theURL so i know that is is filled with
the correct information. I couldnt find out what the false was for, so
I changed that to true, and got this error: The data necessary to
complete this operation is not yet available.

I am so lost, is there anyone that might have ideas on how to get the
above working. If I just put the URL into the browser, if works OK, so
I know the syntax of theURL is fine.

Thanks for your time,
Robert

Jul 19 '05 #2
I am trying to do something very similar... I however get my page to
display, however, the refresh button does not work, it will just produce a
blank page.
Any body know why the refresh would not work?

My Code is the following:

<%@ Language=VBScript %>

<%
Option Explicit
%>

<%

Const adTypeBinary = 1
Const adReadAll = -1

Dim oStream
set oStream = server.CreateObject("ADODB.Stream")
oStream.Type = 2
oStream.Charset = "ascii"
oStream.Open "URL=http://testserver/test/hello.htm", 1, -1

'Response.write oStream.State
'Response.End
'oStream.Read

'Response.Write oStream.Size
'Response.End

oStream.Position = 0
Response.ContentType = "text/html"
Response.Write oStream.ReadText
Response.Buffer = True

oStream.close

"Robert Brown" <rb****@edium.com> wrote in message
news:bd*************************@posting.google.co m...
Hi All,

I am creating an interface into a Payment Gateway. I need to access a
URL (which is a perl script) with paramters attached. I will then get
a response within 10 seconds with information I need to formulate into
my pretty asp page.

I didn't know where to start but I have read alot about adodb.stream.
I setout to write some code and this is what I have done:

Set objStm = Server.CreateObject("ADODB.Stream")
objStm.Type = adTypeText
objStm.Open "URL=" & theurl, admoderead, 8
objStm.Charset = "ascii"
strText = objStm.ReadText
Response.Write strText

theURL variable contains the URL with the payment parameters.

On the open line however, I get an error c004800a. What the hell this
means I don't know. It doesn't matter what I put into theURL even if
it is something like www.yahoo.com, I still get the same error....

Ok, I read an interesting post about using XMLHTTP. I created the code
as follows:

Dim xmlhttp
Set xmlhttp = Server.CreateObject("MSXML2.XMLHTTP")
xmlhttp.Open "GET", theURL, false
xmlhttp.Send
Response.write xmlhttp.responseText

This seems to work very well. I actually got an error back from the
payment gateway stating NO PARAMETERS SUPPLIED. Realising this, I used
a POST rather than GET. Doing this I got FAILED NEED LOGIN although
the Login information was passed as two of the parameters in the URL.
I am doing a response.write of theURL so i know that is is filled with
the correct information. I couldnt find out what the false was for, so
I changed that to true, and got this error: The data necessary to
complete this operation is not yet available.

I am so lost, is there anyone that might have ideas on how to get the
above working. If I just put the URL into the browser, if works OK, so
I know the syntax of theURL is fine.

Thanks for your time,
Robert

Jul 19 '05 #3
I have no experience using ADODB.Stream to read remote pages, but I use
XMLHTTP in many scenarios almost daily and rarely come across any issues.
See http://www.aspfaq.com/2173

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Jim C" <cl********@hotmail.com> wrote in message
news:u4**************@tk2msftngp13.phx.gbl...
I am trying to do something very similar... I however get my page to
display, however, the refresh button does not work, it will just produce a
blank page.
Any body know why the refresh would not work?

My Code is the following:

<%@ Language=VBScript %>

<%
Option Explicit
%>

<%

Const adTypeBinary = 1
Const adReadAll = -1

Dim oStream
set oStream = server.CreateObject("ADODB.Stream")
oStream.Type = 2
oStream.Charset = "ascii"
oStream.Open "URL=http://testserver/test/hello.htm", 1, -1

'Response.write oStream.State
'Response.End
'oStream.Read

'Response.Write oStream.Size
'Response.End

oStream.Position = 0
Response.ContentType = "text/html"
Response.Write oStream.ReadText
Response.Buffer = True

oStream.close

Jul 19 '05 #4
Hi Jim..

That I can help you. When the page is loaded through the stream, it is
only "text" representation of the page. Have a look at the source you
are getting back. That's why the Refresh button can't refresh anything.

Hope this helps,
Robert

PS: Least you get something... hee hee

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #5
Thanks for your reply... I knew someone would have a lead for me.

I put the code in as the example, except I am getting this error:

The system cannot locate the resource specified.

when I issue the xmlhttp.send "x=1&y=2" (made up params).

I don't want to impose too much, but would you have some time to help me
out again..

Thanks,
Robert

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #6
Can you show all of the code, including the URL you are trying to hit. That
way someone can try to reproduce, instead of guessing what's going on. :-)

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Robert Brown" <ro****@joshie.com.au> wrote in message
news:eL**************@TK2MSFTNGP09.phx.gbl...
Thanks for your reply... I knew someone would have a lead for me.

I put the code in as the example, except I am getting this error:

The system cannot locate the resource specified.

when I issue the xmlhttp.send "x=1&y=2" (made up params).

I don't want to impose too much, but would you have some time to help me
out again..

Thanks,
Robert

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #7
Yep.. Sure.. That was going to be my next step.

I will have too put bogus params in though as this contains credit card
stuff... but here goes:

theMainURL =
"https://4tknox.au.com/cgi-bin/themerchant.au.com/ecom/external2.pl"

theParams = "LOGIN=xxx/xxxx&COMMAND=purchase&AMOUNT=" & CreditAmount&
"&CCNUM=" & CreditCard & "&CCEXP=" & CreditExpiry & "&COMMENT=" &
CreditComment

Dim xmlhttp
'Set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP") if I use this
line above I get the following error on the send: msxml3.dll error
'80072f8f' System error: -2147012721

Set xmlhttp = Server.CreateObject("MSXML2.XMLHTTP")
xmlhttp.Open "POST", theMainURL, false
xmlhttp.setRequestHeader "Content-Type",
"application/x-www-form-urlencoded"
xmlhttp.send theParams

Response.write xmlhttp.responseText
That's it.. I hope you can make some sense of it.

Thanks,
Robert

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bob Murdoch | last post by:
I'm receiving a sporadic error: "The remote procedure call failed and did not execute", when calling the following page: <%@ language="JavaScript" %> <% var vPath =...
0
by: Channing Jones | last post by:
Hello everyone, I am trying to store data in a binary field of an SQL-Server table using ADODB. So far, I have managed to store a record but not any data in the binary field. I only get...
3
by: katrinaVictim | last post by:
Please copy and paste the full code source into any .asp page and pull the page from the browser. Make sure all components are up to date. Explain why number1 is treated differently than number2...
4
by: Jack | last post by:
Hi, I am trying to run an example code from a book. However I am getting the following error message: Number: -2147217900 Description: Syntax error or access violation Source: Microsoft OLE...
3
by: CD | last post by:
An application is logging faxes sent in SQL2000 image column type. I have found code on the net but what it is doing is prompting to save to local which is fine for single page image. Not good...
3
by: dale.zjc | last post by:
I've got some bizarre behavior going on with my ASP code below. For some strange reason (and I'm a newbie to ASP so it's probably obvious to others) I can't display all the rows of data from the...
7
by: iporter | last post by:
I use the code below to authorise the download of certain files. Thus, instead of linking to the file in a wwwroot directory, I link to this code with the filename as a parameter, and the script...
0
by: klove1209 | last post by:
Good afternoon. I need assistance with calling a function on the back end, that takes paremeters for a stored procedure. Then, that function returns the recordset back to the main DB. Below is the...
0
by: klove1209 | last post by:
Good afternoon. I need assistance with calling a function on the back end, that takes paremeters for a stored procedure. Then, that function returns the recordset back to the main DB. Below is the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.