AutoHotkey Community

It is currently May 26th, 2012, 9:27 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 233 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 16  Next

Should a more generic function be released which will include the already available web functions, such as header queries, uri encoding, base encoding, etc ?
yes, i'd like to have one function to get all neccessary http functionalities in one instead of collecting each for my own
no, i prefer collecting the functions i need
neither nor ... explained in post
You may select 1 option

View results
Author Message
 Post subject:
PostPosted: July 27th, 2008, 12:30 pm 
Offline

Joined: March 11th, 2008, 11:36 pm
Posts: 291
@ skrommel

the weird thing is they returns 404 even it's POSTed successfully. when i removed error handling for 404 temporarily in HttpQuery. i could got the result properly.

just simply add 404 at the line around 183 in httpquery.ahk

    if !(InStr("100 200 201 202 302",RetValue)) {

should be

    if !(InStr("100 200 201 202 302 404",RetValue)) {


Code:
httpQuery(Var, "http://pastebin.com/pastebin.php", "poster=HttpQueryTest&format=Python&paste=send&expiry=d&code2=Testing a bit..")
VarSetCapacity(Var, -1)
Gui, Add, Edit, w600 h400 , %Var%
RegExMatch(Var,"<li class=""highlight""><a href=""(.+?)"">",Out)
Gui, Add, Edit, w600, %Out1%
Gui, Show

_________________
Easy WinAPI - Dive into Windows API World
Benchmark your AutoHotkey skills at PlayAHK.com


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 27th, 2008, 1:00 pm 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
@heresy this patch is not needed i fixed it in the function thus resulting an update to v0.3.3. disabling the 404 handling is IMHO not a good idea.

The Problem as far as i've understood it, was that the httpQuery function tried to access the Header response Location setting which is not accessible at that time (so its a timing problem) introducing the httpQueryDwFlags variable solves this problem (also others such as pages from mozdev) an example how to set this property and use it properly is shown in 1st post as example V.

more updates:
httpQueryReferer [sic] allows custom referrer set
httpQueryAcceptTypes allows custom set accept types for received datastreams.

greets
DerRaphael

_________________
Image
    All scripts, unless otherwise noted, are hereby released under CC-BY


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 28th, 2008, 12:59 am 
Offline

Joined: July 30th, 2004, 8:50 pm
Posts: 192
:) Then it wasn't just me... Thanks a million, DerRaphael!

Skrommel

_________________
www.1HourSoftware.com


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 28th, 2008, 10:03 am 
Offline

Joined: March 11th, 2008, 11:36 pm
Posts: 291
DerRaphael wrote:
@heresy this patch is not needed i fixed it in the function thus resulting an update to v0.3.3. disabling the 404 handling is IMHO not a good idea.
dude i never expect that you can solve it without breaking the easy interface :) well done!

_________________
Easy WinAPI - Dive into Windows API World
Benchmark your AutoHotkey skills at PlayAHK.com


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 30th, 2008, 8:02 am 
Great work DerRaphael, really inspiring :D


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 31st, 2008, 7:38 pm 
i am currently having a problem understanding why i cannot get an updated page source when i use this script. i am sure i am missing something but honestly i am still a beginner.

Code:
#Include httpQuery-0-3-2.ahk
s:
   html =
   URL = http://watchout4snakes.com/creativitytools/RandomWord/RandomWord.aspx

   length := httpQuery(html,URL)
   varSetCapacity(html,-1)

   StringGetPos,HPos1,html,"randomWord"
   HPos1 += 13
   StringGetPos,HPos2,html,<,,%HPos1%
   Count := HPos2 - HPos1
   HPos1 += 1
   StringMid,word,html,%HPos1%,%Count%

   msgbox,%word%
   sleep,5000
   goto,s


my second query is if this is the correct way to set global var for httpquery. this part i am totally unsure. would these need to be set before the include?

Code:
global httpProxy := 193.146.209.5:80
global httpQueryReferer := "http://www.autohotkey.com"


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 1st, 2008, 9:54 am 
Offline

Joined: December 19th, 2006, 2:14 pm
Posts: 72
Location: France
Hi

My suggestions :

1) By default, have an auto-proxy discovery, ie. enable a keyword for global var httpProxy (for instance "auto-discover", have that httpProxy var default to that keyword. This can be achieved by the following way, for instance : read "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" value "ProxyServer"
This would enable running other's submitted httpQuery-based scripts without change (my first tries on your samples won't work due to my Proxomitron usage)

2) add a comment in your code refering to this topic (always useful not to have to remember or add to favorites a topic for each useful script :) )

3) don't put a version number in the suggested filename for the lib in 1st post, since the published code shouldn't rely on it in #include. To explain further, I made a copy/paste of lib in file "httpQuery-0-3-3.ahk" (as suggested in first post), then copied the xkdc comics sample to a "sample_http.ahk" file in same dir, ran it and... it of course broke since that's an implicit include under "httpQuery.ahk" name... I think as a generic good rule of thumb that lib file names should not include version number, but, of course, the version number must be kept inside the file itself.

You may look at the header of my Ascii85 code for sample of what I mean.

Anyway, very nice and impressive work. Thanks for sharing. Will probably become very popular.

_________________
Assembler-coded MCode.ahk ASCII85.ahk library


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 1st, 2008, 11:47 am 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
Azerty wrote:
...(my first tries on your samples won't work due to my Proxomitron usage)...
Sorry can't resist to say Hi to a fellow Proxomitron user. I've been using it for a very long time.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 21st, 2008, 3:05 am 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
Quote:
HttpRetCodes...418=I'm a teapot (RFC 2324)...

no way..
Quote:
RFC 2324
2.3.2 418 I'm a teapot

Any attempt to brew coffee with a teapot should result in the error
code "418 I'm a teapot". The resulting entity body MAY be short and
stout.
huh.

_________________
Image
ʞɔпɟ əɥʇ ʇɐɥʍ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 21st, 2008, 9:43 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
fascinating stuff really

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 7th, 2008, 11:52 pm 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
minor bugfix in version 0.3.4 - sometimes the returned size may differ from updated size via VarSetCapacity(data,-1). The returned size was correct, but the datasize might have had some corrupted data which lead to some strange chars being appended to the variable. this is fixed, as httpQuery sets buffersize greater than needed and prefills the variable with binary zeros.

also fixed the examples just to include httpQuery.ahk not the httpQuery-varVersion.ahk name style.

thanks
and have fun
dR

_________________
Image
    All scripts, unless otherwise noted, are hereby released under CC-BY


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 9th, 2008, 3:51 am 
I may be missing something but how would we handle the data that shows up in the "Query String" tab on HttpFox?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 9th, 2008, 8:22 pm 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
hobdiddy wrote:
I may be missing something but how would we handle the data that shows up in the "Query String" tab on HttpFox?

the data showing up in the query string is the url for httpQuery function.
When clicking on the POST tab and there on the RAW view u'll get a ready to copy POST entry which was actually sent to the target server.
by modifying the data you see there (u'll need to uriEncode your fresh ones) you can use this to send it via autohotkey to the server with a modified content.

greets
dR

_________________
Image
    All scripts, unless otherwise noted, are hereby released under CC-BY


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 10th, 2008, 12:30 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
I am not really sure which thread is the correct one for help so here goes http://www.autohotkey.com/forum/viewtop ... 244#219244 i know these 2 threads are related so if someone knows the answer let me know

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 22nd, 2008, 9:37 am 
Can't seem to get it to work right. :evil:

Code:
087: if (Strlen(POSTDATA)>0) 
087: {
088: HTTPVerb := POST
089: if StrLen(Headers)=0 
090: HEADERS := Content-Type: application/x-www-form-urlencoded
091: }
096: hRequest := DllCall("WinINet\HttpOpenRequestA","uInt",hConnect,"Str",HTTPVerb,"Str",lpszUrlPath . lpszExtrainfo,"Str",ProVer := "HTTP/1.1", "Str",httpQueryReferer,"Str",httpQueryAcceptTypes,"u
103: sRequest := DllCall("WinINet\HttpSendRequestA", "uInt",hRequest,"Str",Headers, "uInt",Strlen(Headers), "Str",POSTData,"uInt",Strlen(POSTData))
107: VarSetCapacity(header, 2048, 0) 
108: VarSetCapacity(header_len, 4, 0) 
112: Loop,5
113: if ((headerRequest:=DllCall("WinINet\HttpQueryInfoA","uint",hRequest,"uint",21,"uint",&header,"uint",&header_len,"uint",0))=1) 
113: if ((headerRequest:=DllCall("WinINet\HttpQueryInfoA","uint",hRequest,"uint",21,"uint",&header,"uint",&header_len,"uint",0))=1) 
113: if ((headerRequest:=DllCall("WinINet\HttpQueryInfoA","uint",hRequest,"uint",21,"uint",&header,"uint",&header_len,"uint",0))=1) 
113: if ((headerRequest:=DllCall("WinINet\HttpQueryInfoA","uint",hRequest,"uint",21,"uint",&header,"uint",&header_len,"uint",0))=1) 
113: if ((headerRequest:=DllCall("WinINet\HttpQueryInfoA","uint",hRequest,"uint",21,"uint",&header,"uint",&header_len,"uint",0))=1) 
117: if (headerRequest=1) 
125: res := timeout
128: Loop,Parse,res,
,

129: {
130: RetValue := A_LoopField
131: Break
135: if (RetValue="timeout") 
135: {
136: html := Error: timeout
137: Return,-1
014: varSetCapacity(html,-1) 
016: Gui,Add,Edit,w600 +Wrap r25,html
017: Gui,Show


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 233 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 16  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: stevep and 20 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group