PB and ASP

Just starting out? Need help? Post your questions and find answers here.
cecilcheah
Enthusiast
Enthusiast
Posts: 168
Joined: Wed Jun 04, 2003 8:44 am
Location: Switzerland

PB and ASP

Post by cecilcheah »

Is there anyway PB can send some values to an ASP page without opening a web browser at all.

CC
NetSlayer
New User
New User
Posts: 4
Joined: Mon Nov 15, 2004 4:25 pm
Location: Germany
Contact:

Post 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
Regards, NetSlayer
naw
Enthusiast
Enthusiast
Posts: 573
Joined: Fri Apr 25, 2003 4:57 pm

Post 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
Ta - N
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post 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:
--Kale

Image
cecilcheah
Enthusiast
Enthusiast
Posts: 168
Joined: Wed Jun 04, 2003 8:44 am
Location: Switzerland

Post 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
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post 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. :)
@}--`--,-- A rose by any other name ..
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post 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.
@}--`--,-- A rose by any other name ..
cecilcheah
Enthusiast
Enthusiast
Posts: 168
Joined: Wed Jun 04, 2003 8:44 am
Location: Switzerland

Post by cecilcheah »

Thanks a lot.

CC
Post Reply