Jump to content

vanner

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

vanner's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. thanks for the quick reply. I'm trying to grab Maxim Online's daily girl image on [a href=\"http://maximonline.com/todays_girl/\" target=\"_blank\"]http://maximonline.com/todays_girl/[/a]. They put the daily image in a [a href=\"http://maximonline.com/todays_girl/girls/\" target=\"_blank\"]http://maximonline.com/todays_girl/girls/[/a] directory. Example: [a href=\"http://maximonline.com/todays_girl/girls/rachel_nichols/gfd_med.jpg\" target=\"_blank\"]http://maximonline.com/todays_girl/girls/r...ols/gfd_med.jpg[/a] So basically, I want my script to look at [a href=\"http://maximonline.com/todays_girl\" target=\"_blank\"]http://maximonline.com/todays_girl[/a] source and grab: [code] <img src="/todays_girl/girls/rachel_nichols/gfd_med.jpg" [/code] and print out the image on my webpage. Go ahead and test the code yourself: [code] <?php // Fetch webpage $url = file_get_contents('http://maximonline.com/todays_girl/'); // Look for this image: <img src="/todays_girl/girls/*/*.jpg" preg_match('#(?<=<img src="/todays_image/girls/).+\.jpg(?=">)#i', $url, $matches); $file = $matches[1]; echo ' <html>   <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">   <img src="http://maximonline.com/todays_girl/girls/$file"> </head> </html>'; ?> [/code]
  2. I'm writing a script that snoops for an image on a webpage and prints it out from the source. Can someone help me out with the reg expression? Also, does my coding goin in the right direction with what I want to do? [code] <?php // Fetch webpage $url = file_get_contents('http://example.com/todays_image/'); // Look for this image which is changed daily. <img src="/todays_image/girls/<RANDOM FOLDER NAME>/<RANDOM FILENAME>.jpg" preg_match("/<img src=\"\/todays_girl\/girls\/([a-zA-Z_0-9]\/([a-zA-Z_0-9]\+.jpg)/i",$url, $matches); $file = $matches[1]; echo ' <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <img src="http://example.com/todays_girl/$file"> </head> </html>'; ?> [/code]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.