Hmm...
Your code looks good, but I think I didn't fully explain myself as to what my objective was.
I'll try again.
I have a website, it's a pretty little website, growing, strong.. good bones and hair.
I want to use an image file (islandcam.jpg) from another website (peiplay.com) and place it onto my little website.. nothing too extravagent.
The image -used- to be referenced in such a way as: "domain.com/islandcam/islandcam.jpg" and was easily accessed on any webpage in the world.. Until monday.
Of course, the owners decided to be smart (as the great Homer says it, "s-m-r-t"), and changed their image access in such a way that it requires a php file to retrieve the .jpg file. I suspect that the php file is performing a comparison on HTTP_referrer or some such, and is ignoring all that are not local to the webserver.
My question is this: How does one retrieve a webpage, with all the contents therein, and extract an image from the resulting page?
I thank you all very much for your time, in advance.
-Chris Simmons
www.peitourism.com
Anna Koop wrote:
This is probably not the simplest way to do it, but:
<?
$page=implode("\n", file($webpage));
$page1=explode("src=", $page);
for($i=0; $i<count($page1); $i++)
{
$page2=explode(">", $page1[$i]);
$image[$i]=$page2[0];
}
?>
Then the $image array would (probably) have the link for all the images on the page.
Like I said, not simple, not really pretty. And you'll end up possibly having extra stuff, like height and width attributes. It depends on how the code is written.
Isn't there a way to get an array of images on a web page?
Good luck.