kohle Posted August 17, 2007 Report Share Posted August 17, 2007 Dear Forum, I want to automation a request to a Website. The website is Password protected and its technology is aspx. I surfed a lot in the internet but did not find a finished work **g**. So therefore i try it by myself (even thou I am a beginner) My first way was to analyse the traffic if I connect the password protected Website. So far so good. Now I try to reverse engineering this Protocol. Now I have some code and it works. But I have Performance Problems. Every Sequence takes about 5 seconds and after 8 Sequences one complete request needs about 40 sec. Now my question: How can I read the content from a website? My big Problem is that I do not know the content length from every request therefore I have no value for the "Byte to Read" (TCP_READ). And if I use the "Time Out" function, I have to wait every request for five or more seconds. I hope anybody can help me to solve this problem. For a better understanding I add a Picture. THX :headbang: Quote Link to comment
LAVA 1.0 Content Posted August 17, 2007 Report Share Posted August 17, 2007 From what I can recall, you can use the datasocket VIs. This is actually already noted somewhere on NI's site, just not sure right now. But you will get the entire string of the page as the browser would get. Quote Link to comment
kohle Posted August 17, 2007 Author Report Share Posted August 17, 2007 Thank for your answer. I tried to do this with DataSocket Vi's. Now I don't know how I should do the POST State. Activity: 1.) Request to the Login screen --> there are Fields with Username and Passwort (i tested with dataSocket --> it works) 2.) From this request you get Parameters: _ViewState, SessionID 3.) Now i have to POST this Data and Username Password: Example: POST /(24lqx0asze5cjyztmmym2vn3)/eu_default.aspx HTTP/1.1 Host: wos.xxx.xx User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://wos.xxx.xx(24lqx0asze5cjyztmmym2vn3)/eu_default.aspx Content-Type: application/x-www-form-urlencoded Content-Length:523 __VIEWSTATE=dDw2NjQxNjI3Njg7dDw7bDxpPDI%2BOz47bDx0PDtsPGk8MD47PjtsPHQ8O2w8aTwwPjtpPDI%2BO2k8ND47aTw 2Pjs%2BO2w8dDxwPHA8bDxUZXh0Oz47bDxBTk1FTERVTkc7Pj47Pjs7Pjt0PHA8cDxsPFRleHQ7PjtsPEJlbnV0emVybmFtZTs%2BP s%2BOzs%2BO3Q8cDxwPGw8VGV4dDs%2BO2w8UGFzc3dvcnQ7Pj47Pjs7Pjt0PHA8cDxsPFRleHQ7PjtsPEFubWVsZGVuOz4%2B Oz47Oz47Pj47Pj47Pj47PqvrANTwwZYLHc5dVU5UoU1HdDcA&Enduser_Loginform%3AUsername=u_name&Enduser_Loginform %3APassword=password&Enduser_Loginform%3Aloginform_submit=Anmelden&eu_checklogin=1&SessionID=94955664-36401868-18-36-17 After this POST i should get back the Password Protected content, but how can i do a POST with DataSocket Thank's a lot for Answers :headbang: Pic2= old one Pic3= new one Quote Link to comment
jbrohan Posted August 17, 2007 Report Share Posted August 17, 2007 Hello I do not know about the ASPX But I do this a lot with websites written in PHP. The cURL.exe program works very naturally and conveniently. In the case you want for example to return some values from a web program, you simply execute the php program with the $_POST parameters from cURL. You run a System_Exec function from LabVIEW. Good Luck John Quote Link to comment
MikaelH Posted August 18, 2007 Report Share Posted August 18, 2007 A normal POST is done like this: http://forums.lavag.org/index.php?act=attach&type=post&id=6665 POST /cgi-bin/somefile.pl HTTP/1.0 Host: ni.com From: me@ni.com User-Agent: HTTPTool/1.0 Content-Type: application/x-www-form-urlencoded Content-Length: %d <MESSAGE HERE> //Mikael Quote Link to comment
kohle Posted August 18, 2007 Author Report Share Posted August 18, 2007 THX for Answer MikaelH I do this at the moment very similar. But you also do in your Block-diagram 1000 bytes to read - but you do not know how many byte you get from this request back and this is my main Problem. And if I set 10.000 bytes to read, then you use the time out function (because the TCP_read function is a "blocking" function) I hope you can understand what I mean (sorry for my poor English) nice day kohle Quote Link to comment
kohle Posted August 19, 2007 Author Report Share Posted August 19, 2007 THX for this hint, I will try it nice day thomas Quote Link to comment
kohle Posted October 8, 2007 Author Report Share Posted October 8, 2007 :headbang: ------------------------------------------------------------------------------------------------ Problem Solved: :thumbup: : I solved the problem with a 3rd Party tool called: cURL --> is a command line tool: This tool have nice features. VI is posted BR Kohle Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.