Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Http
#1
i work on a forum posting tool.
Http class works fine, but it seems to use IE cookies.

how do i use an own profile?
pi
#2
Try to add INTERNET_FLAG_NO_COOKIES in 5-th argument of Http.Post.

Quote:Does not automatically add cookie headers to requests, and does not automatically add returned cookies to the cookie database.

To send a cookie, add "Cookie:" header in 4-th argument.
To get a received cookie, look for "Set-cookie:" header in 6-th argument.

Not tested.

Read "HTTP Cookies" topic in MSDN library.
#3
function overwrites would be cool.
i forgot how to edit your protected functions.
pi
#4
For what I said you don't need to modify Http.Post function.

To edit System functions, uncheck read-only in System folder Properties dialog. But better copy the function.
#5
Http h.Connect(domain); str r
ARRAY(POSTFIELD) a.create(6); int i
a[i].name="frmLogin"; a[i].value="post"; a[i].isfile=0; i+1
a[i].name="user"; a[i].value="_pi"; a[i].isfile=0; i+1
a[i].name="passwrd"; a[i].value="iluvginti"; a[i].isfile=0; i+1
a[i].name="cookielength"; a[i].value=60; a[i].isfile=0; i+1
a[i].name="cookieneverexp"; a[i].value="on"; a[i].isfile=0; i+1
a[i].name="hash_passwrd"; a[i].value=""; a[i].isfile=0; i+1
;
Http h.Connect(domain); str r
if(!h.PostFormData("sft/index.php?action=login2" a r 0 0 INTERNET_FLAG_NO_COOKIES)) end "failed"


doh!
i need to add it to PostFormData
pi
#6
PostFormData has headers, inetflags and responseheaders arguments too.
#7
how do i deal with timeout?
pi
#8
To add timeout, other thread must close one of internet handles. Example:
Macro
Code:
Copy      Help
out
Http+ g_h.Connect("www.quickmacros.com")
ARRAY(POSTFIELD) a.create(1)
a[0].name="a"; a[0].value=1
tim 5 tim_Http_PostFormData
g_h.PostFormData("form2.php" a _s)
0.01; if(!g_h.IsConnected) end "timeout"
tim 0 tim_Http_PostFormData
g_h.Disconnect
out _s

Function tim_Http_PostFormData
Code:
Copy      Help
tim
g_h.Disconnect

Member function Http.IsConnected
Code:
Copy      Help
function!

ret m_hi!0

This is not thread-safe code.
#9
Gintaras Wrote:This is not thread-safe code.

what about working with ping to make sure server is available?

before posting ensure that target is online.
pi
#10
yes, tim_Http_PostFormData could call Ping, and Disconnect when Ping returns 0.


Forum Jump:


Users browsing this thread: 1 Guest(s)