-2

i'm trying to navigate through this site http://irl.worldfootball.net/ to get to player's pages. I want to be able to just take the player name variables i have and insert them in the url to get to each player's respective page, but i can't quite figure it out. Can anyone help me?

As you can see from this link http://irl.worldfootball.net/spieler_profil/Wayne-Rooney/ the url is pretty simple, what i want to do is insert the player name of my choice where it says Wayne-Rooney and then navigate to that page. Any help would be greatly appreciated, thanks!

conorw89
  • 45
  • 1
  • 8
  • 2
    What have you tried? You'll get a better answer if you post a bit of code that we can help you correct, than if we have to just dump some random code-snippet on you that you then have to figure out how to change so it matches the rest of your script. :-) – ruakh Mar 04 '12 at 14:18
  • sorry, but i haven't actually tried anything yet, just googling for a solution, all my other code is based around WWW::Mechanize and iterating through links, forms etc from a different website, and i don't really want to have to go to all that trouble for this site again, so that's why i'm looking for a quick solution. Thanks for the reply – conorw89 Mar 04 '12 at 14:33
  • 2
    What's stopping you from using WWW::Mechanize? It should be the right tool for the job. Please do show an attempt – Zaid Mar 04 '12 at 14:38
  • Try the [`.` operator](http://perldoc.perl.org/perlop.html#Additive-Operators). – cjm Mar 04 '12 at 20:17
  • The problem is i am unsure as to how to apply WWW::Mechanize in this way, i have only been using it to navigate through links, i don't really understand how to manipulate the link itself. Thanks for the replies – conorw89 Mar 05 '12 at 01:07

1 Answers1

0

Basically it'll look like this:

my $base_url = 'http://irl.worldfootball.net/spieler_profil/';
my @players_data = ('Wayne Rooney', 'Lionel Messi', 'Thierry Henry');

for (@players_data) {
  my $working_url = $base_url 
                  . ( join '-', split )
                  . '/';
  # processing $working_url now...
}

Processing itself may be done with either WWW::Mechanize (preferable, as for me, if you have some forms to fill and such) or just LWP::Simple (pretty simple to use even for a novice, yet gets the basic job done very well). I'd recommend using the latter if what you need is just collecting the data from pages with simple navigation. )

raina77ow
  • 103,633
  • 15
  • 192
  • 229
  • Thanks for your reply, i shall try this tomorrow. I have been using WWW::Mechanize for all of my other scraping purposes but the site i've been scraping from has no player images, so this is why i'm moving to this site for the image urls. Thanks again. – conorw89 Mar 05 '12 at 01:04