Page 1 of 1

PB and ASP

Posted: Tue Nov 30, 2004 12:23 pm
by cecilcheah
Is there anyway PB can send some values to an ASP page without opening a web browser at all.

CC

Posted: Tue Nov 30, 2004 3:09 pm
by NetSlayer
Just open a connection to your server and send the data in the http header, just like a browser would do.

If you want your data to be transferred via GET (which is the easiest way) you can send a command like this to the server:

Code: Select all

GET /mydir/myfile.asp?mydata=blahblahblah

Posted: Tue Nov 30, 2004 5:03 pm
by naw
The easiest / ugliest way would be to use the webgadget like this:

WebGadget(10, 1, 1, 1, 1, "http://myserver.com/myASP.asp?FNAME=Pure&SNAME=Basic")
HideGadget(10,1)

Ta - N

Posted: Tue Nov 30, 2004 6:49 pm
by Kale
WebGadget(10, 1, 1, 1, 1, "http://myserver.com/myASP.asp?FNAME=Pure&SNAME=Basic")
HideGadget(10,1)
8O You should be ashamed of yourself! :twisted:

Posted: Wed Dec 01, 2004 8:47 am
by cecilcheah
Can PB Receive the Response.write value from any ASP page? Not in the Browser Gadget, but say in a Text Gadget?

CC

Posted: Wed Dec 01, 2004 9:39 am
by Dare2
Hi cecilcheah,

The answer to your question is yes.

I am not able to put up a bit of code (PB side and ASP right) right at the mo, but I should be able to within 24 hours, circs permitting.

Or perhaps someone else will beat me to it.

Also, I think that somewhere in the code archive on http://www.purearea.net/ there is at least one bit of code where a PB program fetches a webpage (generated via ASP, PHP, static HTML, whatever) and stores it in a string (or to disk and then reads to a string). Also, I think, there is some example of this somewhere on these boards, if you want to search there and/or here.

Hopefully you search and find and save yourself some waiting time and me some effort. :)

Posted: Wed Dec 01, 2004 2:11 pm
by Dare2
PB using winApi

Code: Select all

; Either ripped or cobbled together from code found somewhere.
; All I can remember is that something was the template.
; I forget where and who, so apologies to the originator(s)
;   Dare2
#Reload = $80000000

Bfr=AllocateMemory(32000)     ; size to fit your requirements
Bcount=0

keepGoing=#True
hNet.l=0
hURL.l=0
Url.s = "http://www.tabturn.com/purebasic/NowIsTheTime.asp"
  
hNet = InternetOpen_("YourUserAgentNameHere", 1, #Null, #Null, 0) 
hURL = InternetOpenUrl_(hNet, Url, #Null, 0, #Reload, 0) 

While keepGoing
  Delay(1)
  InternetReadFile_(hURL, Bfr, 32000, @Bcount)
  If Bcount = 0
    keepGoing=#False
  EndIf
Wend

InternetCloseHandle_(hURL)
InternetCloseHandle_(hNet)

Debug PeekS(Bfr)
Asp using IIS :) The entire NowIsTheTime script.

Code: Select all

<%response.write "ServerTime = " & now()%>
Instead of debug use whatever.

A man with a great understanding of this sort of thing seems to be Num3 - search on "download" or some other webby keywords, author "num3" for some code, esp non-OS specific.

Posted: Thu Dec 02, 2004 6:50 am
by cecilcheah
Thanks a lot.

CC