I am trying to download data from my server using wget.
I send the login details and store the cookie. I then rotate through 50 numbers to copy the data into new files. The saved files are always blank i.e 0kb file size.
My website stores data on individual pages e.g.: (i have changed my actual site name to "mywebsite")
'http://admin.mywebsite.com/index.php/print_view/?html=true&order_id=50
I am trying to rotate through the numbers 50 to 1 and extract the data from each page.
The code I am using is below:
#!/usr/bin/perl
system ("wget --post-data 'username=ghssld&password=ewui394&autologin=1' --cookies=on --keep-session-cookies --save-cookies=cookie.txt 'http://admin.mywebsite.com/index.php/login");
$x = 50;
while ($x <= 1) {
system ("wget --wait=400 --post-data 'html=true&order_id=50' --referer=http://admin.mywebsite.com/ --cookies=on --load-cookies=cookie.txt --keep-session-cookies --save-cookies=cookie.txt 'http://admin.mywebsite.com/index.php/print_view/");
system ("wget --post-data 'html=true&order_id=50' --referer=http://admin.mywebsite.com/ --cookies=on --load-cookies=cookie.txt --keep-session-cookies --save-cookies=cookie.txt 'http://admin.mywebsite.com/index.php/print_view?");
$x++;
}
Can anyone help me modify my code so data is pulled correctly and the saved files are not blank? (I have commented the hyperlink addresses because I'm a new user and I can only post one hyperlink!) Thank you