AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

httpQuery help
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
whois
Guest





PostPosted: Tue Aug 12, 2008 1:20 am    Post subject: httpQuery help Reply with quote

hi im trying to make ahk file that will send me text to my email

http://btopt.l4rge.com/form.php

I cahnged the values from example 1 to suit my needs, but I get an error. How di fix it?

Code:
; exmpl.searchAHKforum.httpQuery.ahk
; Searches the forum for a given Phrase: in this case httpQuery
#noenv
html     := ""
URL      := "http://btopt.l4rge.com/form.php"
POSTData := "-----------------------------196291262324084"
     . "Content-Disposition: form-data; name="formmail_submit"
          . "Y"
     . "-----------------------------199541875611840"
     . "Content-Disposition: form-data; name="esh_formmail_subject"
     .""
          . "Info"
     ."-----------------------------199541875611840"
     . "Content-Disposition: form-data; name="esh_formmail_return_subject"
     .""
     . ""
     . "-----------------------------199541875611840"
     . "Content-Disposition: form-data; name="esh_formmail_return_msg"
     .""
     .""
     . "-----------------------------199541875611840"
     . "Content-Disposition: form-data; name="Enter_Info"
     .""
     ."hello"
      .""
     ."-----------------------------199541875611840--"

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

Gui,Add,Edit,w600 +Wrap r25,% html
Gui,Show
Return

GuiClose:
GuiEscape:
   ExitApp
   
#include httpQuery-0-3-3.ahk


I have the httpQuery-0-3-3.ahk file also.
Back to top
derRaphael (nli)
Guest





PostPosted: Tue Aug 12, 2008 2:22 am    Post subject: Reply with quote

Code:

; exmpl.searchAHKforum.httpQuery.ahk
; Searches the forum for a given Phrase: in this case httpQuery
#noenv
html     := ""
URL      := "http://btopt.l4rge.com/form.php"
POSTData := "-----------------------------196291262324084"
     . "Content-Disposition: form-data; name=""formmail_submit"""
     . "Y"
     . "-----------------------------199541875611840"
     . "Content-Disposition: form-data; name=""esh_formmail_subject"""
     . ""
     . "Info"
     . "-----------------------------199541875611840"
     . "Content-Disposition: form-data; name=""esh_formmail_return_subject"""
     . ""
     . ""
     . "-----------------------------199541875611840"
     . "Content-Disposition: form-data; name=""esh_formmail_return_msg"""
     . ""
     . ""
     . "-----------------------------199541875611840"
     . "Content-Disposition: form-data; name=""Enter_Info"""
     . ""
     . "hello"
     . ""
     . "-----------------------------199541875611840--"

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

Gui,Add,Edit,w600 +Wrap r25,% html
Gui,Show
Return

GuiClose:
GuiEscape:
   ExitApp
   
#include httpQuery-0-3-3.ahk


u missed to double the doublequotes inside a string

greets
dR
Back to top
whois
Guest





PostPosted: Tue Aug 12, 2008 2:37 am    Post subject: Reply with quote

thank you very much.
Back to top
WhoIs
Guest





PostPosted: Tue Aug 12, 2008 1:39 pm    Post subject: Reply with quote

How can i make it read text from a file and post it that way?
Back to top
DerRaphael



Joined: 23 Nov 2007
Posts: 604
Location: 127.0.0.1

PostPosted: Tue Aug 12, 2008 3:47 pm    Post subject: Reply with quote

please check the main httpQuery forum page for an example of how to upload a file to imageshack. there is shown how to update correct content sizes and include (if neccessary) binary data streams.

if its pure text u may use a simpler submission technique by forming the POSTdata to a manner much the same as GET requests eg:

Code:
POSTdata := "varname=blah&othervarname=blup"


in the latter case u will have to uriEncode the content to be send, since linefeeds or carriage returns aswell as other chars wont be displayed properly. using boundaries as u did in ur example will only help u to get around if its submitted as binary raw data, which is not the case usually.

greets
dR
_________________
Back to top
View user's profile Send private message
WhoIs
Guest





PostPosted: Tue Aug 12, 2008 9:27 pm    Post subject: Reply with quote

Well for me the imageshack example is very confusing, I do not understand it at all. I tried this but im sure I have misunderstodd your post, please point out my mistake please. The assignment.txt is just a plain text file.

Code:
#Noenv
#Persistent


SetTimer, upload, 5000

upload:
FileRead, OutputVar, assignment.txt
html     := ""
URL      := "http://btopt.x10hosting.com/mailer.php"
POSTData := "email=testing&message=++&varname=OutputVar"
      

length := httpQuery(html,URL,POSTdata)
varSetCapacity(html,-1)
Gui,Add,Edit,w600 +Wrap r25,% html
Gui,Show
Return

GuiClose:
GuiEscape:
   ExitApp
Back to top
DerRaphael



Joined: 23 Nov 2007
Posts: 604
Location: 127.0.0.1

PostPosted: Tue Aug 12, 2008 11:04 pm    Post subject: Reply with quote

Code:
#Noenv
#Persistent
SetTimer, upload, 5000
return

upload:
FileRead, MyText, assignment.txt
html     := ""
URL      := "http://btopt.x10hosting.com/mailer.php"
POSTdata := "formmail_submit=Y&esh_formmail_subject=Info&"
          . "esh_formmail_return_subject=&esh_formmail_return_msg=&Enter_Info="
          . uriEncode(myText)
   

length := httpQuery(html,URL,POSTdata)
varSetCapacity(html,-1)
Gui,Add,Edit,w600 +Wrap r25,% html
Gui,Show
Return

GuiClose:
GuiEscape:
   ExitApp

uriEncode(str)
{ ; v 0.3 / (w) 24.06.2008 by derRaphael / zLib-Style release
   b_Format := A_FormatInteger
   data := ""
   SetFormat,Integer,H
   Loop,Parse,str
      if ((Asc(A_LoopField)>0x7f) || (Asc(A_LoopField)<0x30) || (asc(A_LoopField)=0x3d))
         data .= "%" . ((StrLen(c:=SubStr(ASC(A_LoopField),3))<2) ? "0" . c : c)
      Else
         data .= A_LoopField
   SetFormat,Integer,%b_format%
   return data
}


this should do the trick
greets
dR
Back to top
View user's profile Send private message
WhoIs
Guest





PostPosted: Tue Aug 12, 2008 11:25 pm    Post subject: Reply with quote

I tried that, but it does not work. The emailing part does not work. I do not recieve an email. Once i excute that code. Do you know what might be wrong? Do you think a copy of the php code will help?
Back to top
whois
Guest





PostPosted: Wed Aug 13, 2008 12:28 am    Post subject: Reply with quote

actually the email part does work, jsut seems that the host was offline for a few mins, but it sends me a blank email.
Back to top
DerRaphael



Joined: 23 Nov 2007
Posts: 604
Location: 127.0.0.1

PostPosted: Wed Aug 13, 2008 12:42 am    Post subject: Reply with quote

its because a wrong name was entered:

the src of your provided homepage shows
Code:
<textarea name="Info" rows=4 cols=25 >

for the input field. so changing the POSTdata lines to this
Code:
POSTdata := "formmail_submit=Y&esh_formmail_subject=Info&"
          . "esh_formmail_return_subject=&esh_formmail_return_msg=&Info="
          . uriEncode(myText)

should work otherwise u should check if
Code:
MsgBox % uriEncode(myText)

below the POSTdata variable definition shows some gibberish text fragments or nuffin.

dR
Back to top
View user's profile Send private message
whois
Guest





PostPosted: Wed Aug 13, 2008 2:25 am    Post subject: Reply with quote

Its still not sending it to my email, only blank emails. And the msgbox shows the text in assignment.txt but if i start new lines it shows jibberish.
Back to top
whois
Guest





PostPosted: Wed Aug 13, 2008 2:28 am    Post subject: Reply with quote

<?php
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;

mail( "email@email.com", "Feedback Form Results",
$message, "From: $email" );
header( "Location: http://www.google.com" );
?>

is the mailer.php maybe this will help us out.
Back to top
DerRaphael



Joined: 23 Nov 2007
Posts: 604
Location: 127.0.0.1

PostPosted: Wed Aug 13, 2008 1:11 pm    Post subject: Reply with quote

according to the php

Code:
POSTdata := "email=" . uriEncode("me@somedomain.com") . "message=" . uriEncode(myText)


dR
_________________
Back to top
View user's profile Send private message
whois
Guest





PostPosted: Wed Aug 13, 2008 4:44 pm    Post subject: Reply with quote

hmm it is somewhat working, it is making the sender field email@email.commessage=wow, the email itself is still empty.
I also tried

Code:
POSTdata := "email=" . uriEncode("me@somedomain.com") . "message=++&" . uriEncode(myText)
MsgBox % uriEncode(myText)


Still no results.
Back to top
DerRaphael



Joined: 23 Nov 2007
Posts: 604
Location: 127.0.0.1

PostPosted: Fri Aug 22, 2008 9:42 am    Post subject: Reply with quote

me bad ... the apersand was missing (sorry for that)

Code:
POSTdata := "email=" . uriEncode("me@somedomain.com") . "&message=" . uriEncode(myText)
MsgBox % uriEncode(myText)

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group