copy text from source on a web page
Posted on 2000-01-30
This is not going to be easy to explain. Plus, it will probably be very challenging (if it's even possible)for even the expert Perl programmer, thus the high point value. Might I add that I'm a Perl idiot, so even if I get the code from here, I won't be able to decipher it very easily to see how it works. What I need to do is to, with perl, open a web page, go from there to another page by following a link on the 1st page, read specific text on the second page, then write the copied text to a file. Now getting more specific and stating it more clearly:
1) I need to open a specific web page on the web. This is a password protected page, but I can put my username:password in the URL anyway (since I DO have one).
2)Now that I'm on page 1, there is a link on that page that I need to follow (please tell me this is possible). The second page is actually on a different web server that the 1st page is linking (referring) to. (The 2nd page can only be accessed by first accessing the 1st page). There is a link on page1 that will take me directly to page2. This is the ONLY way to get to page2 otherwise it won't work.
3)Once I'm on page2 (if the above is even possible), I need to read the source code of page2 (if this is possible). I need to copy two text's (variables) from the code. The code for page2 will be in the format of:
<b>Username: username1</b> and <b>Password: password1</b>
I need to copy the text "username1" and the text "password1" and write them to a *.js file. The *.js file will have a specific format that I need to specify in the Perl file. "username1" and "password1" will be inserted in the appropriate places. I also need to know how to insert the copied text's(variables) where I need them.
3)Finally, I need to automatically run this Perl file every few hours. I am running Red Hat Linux 6.x and I am still unsure where to place this file and how to tell Linux to run the file once every specified # of minutes or hours.
I don't know if this all is possible using Perl or any other language, but it IS possible to do by hand (using internet explorer, my brain, my fingers, and a text editor), so one way or another it has to be possible to automate the process.