Http Dll 2
#41
Posted 24 August 2011 - 04:05 AM
I'm quite interested in your really cool http request functions especially being able to set post parameters, that's pretty awesome. Now I understand how to do text box forms pretty well but I was wondering if you would be able to check radio boxes? to my understanding the display text is the value and they have another variable called checked and it has to be set to "checked." I'm not sure how to do this with your DLL. Any help is appreciated!
ThanX
RobotiX
#42
Posted 24 August 2011 - 09:35 AM
<input type="radio" name="test" value="1"> Option 1<br> <input type="radio" name="test" value="2"> Option 2<br> <input type="radio" name="test" value="3"> Option 3<br>So if you want to select option 2, you should do this:
httprequest_set_post_parameter(request, "test", "1");
#43
Posted 25 August 2011 - 04:59 AM
<input name="group1" value="Verizon" type="radio">It must be my attempt at the file upload form... Which I'm not sure how to take care of.
ThanX
RobotiX
#44
Posted 26 August 2011 - 08:15 PM
#45
Posted 27 August 2011 - 12:45 AM
Here is the code for TxtDrop, works flawlessly.
//argument0: (string) 10 Digit Phone Number
//argument1: (string) Message
//argument2: (string) Return E-mail address
txt_req=httprequest_create();
httprequest_set_post_parameter(txt_req, "submit", "Send");
httprequest_set_post_parameter(txt_req, "submitted", "1");
httprequest_set_post_parameter(txt_req, "body", argument1);
num=argument0;
num=string_digits(num);
area_code=string_copy(num, 1, 3);
exchange=string_copy(num, 4, 3);
num=string_copy(num, 7, 4);
httprequest_set_post_parameter(txt_req, "npa", area_code);
httprequest_set_post_parameter(txt_req, "exchange", exchange);
httprequest_set_post_parameter(txt_req, "number", num);
httprequest_set_post_parameter(txt_req, "emailfrom", argument2);
httprequest_connect(txt_req, "http://www.txtdrop.com/",1);
while (httprequest_get_state(txt_req)>0 && httprequest_get_state(txt_req)<4)
{
httprequest_update(txt_req);
}
httprequest_destroy(txt_req);And here is my attempt at PixDrop.
//argument0 (string) 10 Digit Phone Number
//argument1 (string) Carrier: "Verizon", "At&t", "Sprint", or "T-Mobile"
//argument2 (string) Filename
pix_req=httprequest_create();
httprequest_set_post_parameter(pix_req, "genit", "Send Your Picture Message");
httprequest_set_post_parameter(pix_req, "group1", argument1);
httprequest_set_post_parameter(pix_req, "userfile", argument2);
num=argument0;
num=string_digits(num);
httprequest_set_post_parameter(pix_req, "to", num);
httprequest_connect(pix_req, "http://www.pixdrop.com/",1);
while (httprequest_get_state(pix_req)>0 && httprequest_get_state(pix_req)<4)
{
httprequest_update(pix_req);
}
httprequest_destroy(pix_req);I think it might be because there is a file being uploaded I need to use a buffer but I don't know the uploaded file name and I'm not sure how to use the buffers.
Thanks for taking the time to figure this out.
RobotiX
#46
Posted 28 August 2011 - 02:14 PM
"Verizon", "AT&T", "Sprint", "Tmobile"
I think this should work:
//argument0 (string) 10 Digit Phone Number
//argument1 (string) Carrier: "Verizon", "AT&T", "Sprint", or "Tmobile"
//argument2 (string) Filename
var pix_req, num, b, st;
b = buffer_create();
if (!buffer_read_from_file(b, argument2)) {
buffer_destroy(b);
return false; // file does not exist
}
pix_req=httprequest_create();
num=string_digits(argument0);
httprequest_set_post_parameter(pix_req, "group1", argument1);
httprequest_set_post_parameter(pix_req, "to", num);
httprequest_set_post_parameter(pix_req, "MAX_FILE_SIZE", 200000);
httprequest_set_post_parameter(pix_req, "genit", "Send Your Picture Message");
httprequest_set_post_parameter_file(pix_req, "userfile", filename_name(argument2), b);
buffer_destroy(b);
httprequest_connect(pix_req, "http://www.pixdrop.com/", 1);
while (true) {
httprequest_update(pix_req);
st = httprequest_get_state(pix_req);
if (st=4 or st=5) {
break;
}
sleep(10);
}
httprequest_destroy(pix_req);
return (st=4);
#47
Posted 01 September 2011 - 03:37 AM
It looked so nice too...
#48
Posted 01 September 2011 - 12:26 PM
Also, are you sure the phone number should be entered without the '-' characters?
Maybe it will work if you try it without string_digits?Recipients mobile number: (i.e 212-867-5309)
#49
Posted 10 September 2011 - 06:56 PM
I'd like to use it with a website where I need to get logged in before accessing... how can I do that with this dll ? Do you have an idea ?
#50
Posted 11 September 2011 - 11:18 AM
The easiest way to find out how this works is to install a browser plugin that can log the HTTP requests. If you're using Firefox you can try 'HttpFox'. Tell the plugin to log the HTTP requests, and then log in to the website as usual and do whatever action you want the program to perform later. Afterwards you can read the HTTP requests log to find out what parameters the browser is sending. For every page, you should find out:At last I found a download dll that I really like !
I'd like to use it with a website where I need to get logged in before accessing... how can I do that with this dll ? Do you have an idea ?
- what url the browser connects to (easy)
- what GET and POST parameters are sent by the browser
- what cookies are sent by the browser
Once you know all this, you can use the DLL to imitate the requests.
#51
Posted 12 September 2011 - 11:35 PM
httprequest = httprequest_create(); httprequest_set_request_header(httprequest, '(Request-Line)', 'GET /forum/viewtopic.php?t=291 HTTP/1.1', 0); httprequest_set_request_header(httprequest, 'Host', '<the website I try to access>', 0); httprequest_set_request_header(httprequest, 'User-Agent', 'Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/20100101 Firefox/6.0.2', 1); httprequest_set_request_header(httprequest, 'Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 1); httprequest_set_request_header(httprequest, 'Accept-Language', 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3', 1); //httprequest_set_request_header(httprequest, 'Accept-Encoding', 'gzip, deflate', 1); /* I had to disable this one or the html I got was coded and unreadable to me */ httprequest_set_request_header(httprequest, 'Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 1); httprequest_set_request_header(httprequest, 'DNT', '1', 1); //httprequest_set_request_header(httprequest, 'Connection', 'keep-alive', 1); httprequest_set_request_header(httprequest, 'Cookie', '<the values>', 1); state = ""; progress = 0; filesize = 0; downloadspeed = 0; previoustime = current_time; previoussize = 0; httprequest_connect(httprequest, <the url I try to access>, false);But I still get this page as no logged in...
Edited by Dom83, 12 September 2011 - 11:39 PM.
#52
Posted 13 September 2011 - 10:27 PM
#53
Posted 13 September 2011 - 11:28 PM
httprequest_set_request_header(httprequest, 'Cookie', 'phpBB2_forum___tt=1315855026; phpBB2_forum___f=a%3A0%3A%7B%7D; phpBB2_forum___uf=1315438704; <and so on> ...', 1);Where is my error ?
Edited by Dom83, 13 September 2011 - 11:31 PM.
#54
Posted 15 September 2011 - 04:50 PM
Instead, you'll need to send a login request (that is, the request your browser sends when you actually press the Login button). The site should send information back, including the cookies you'll need to send from that point on to let the site know you're already logged in.
-IMP
Edited by IceMetalPunk, 15 September 2011 - 04:50 PM.
#55
Posted 15 September 2011 - 09:38 PM
Edited by Dom83, 15 September 2011 - 09:39 PM.
#56
Posted 15 September 2011 - 10:36 PM
-IMP
#57
Posted 15 September 2011 - 11:44 PM
httprequest_set_post_parameter(httprequest, "username", "<my user name>"); httprequest_set_post_parameter(httprequest, "password", "<my pw>"); httprequest_set_post_parameter(httprequest, "redirect", ""); httprequest_set_post_parameter(httprequest, "login", "Log in");
Then when the download of this login page had succeed, I get the cookies from the header infos, this way :
new_cookies = "";
nb_responses = httprequest_get_response_header_count(httprequest) ;
for ( i=0 ; i<=nb_responses ; i+=1 )
{
response_temp = httprequest_get_response_header_value(httprequest, i);
if ( string_count( 'domain=' , response_temp ) )
{
end_of_cookie = string_pos( ';' , response_temp ) ;
response_temp = string_copy( response_temp , 0 , end_of_cookie ) ;
new_cookies = new_cookies + response_temp ;
}
}
show_message( new_cookies ) ; /* the value it shows me looks ok */
And then, to get the page I was trying to get, I use :
httprequest_set_request_header(httprequest, 'Cookie', new_cookies, 0);
But I still get the page as non-logged in.... Where is my error ?
Edited by Dom83, 15 September 2011 - 11:50 PM.
#58
Posted 16 September 2011 - 12:25 AM
new_cookies = ""; cookies = httprequest_find_response_header(httprequest, "Cookie") ; new_cookies = httprequest_get_response_header_value(httprequest, cookies); show_message(new_cookies);
See if that works instead. Note that a cookie does not end at a semi-colon; the cookies continue on to the end of the Cookie header and must all be sent to replicate the browser's request.
-IMP
#59
Posted 16 September 2011 - 10:49 PM
I also tried with my code but without cutting after the ";" and same...
#60
Posted 17 September 2011 - 03:16 PM
I explain for those who may have same problem some day.
The two cookies the website responses were "Set-Cookie phpBB2_forum_data=..." and "Set-Cookie phpBB2_forum_sid=..." .
They were twice in the header, number 3 and 4, and 6 and 7, and I was taking them all.
I guessed it was no good to have twice same cookies.
So I tried taking only 3 and 4 and it failed...
Then I tried taking only 6 and 7, and... it works !!!
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











