import an image/information from a remote html page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sarah2007
Forum Newbie
Posts: 2
Joined: Mon Apr 23, 2007 7:33 am

import an image/information from a remote html page

Post by sarah2007 »

Hallo,

1/I'd like to import a dynamic image(f(t)) from a distant server by simply calling the URL stocked in my database (example http://xxx.yyy.zzz.200/Sectorr1/florida/florida-day.png),when I click on a button I'd like to display the image on the footer of my page.The problem is that the whole html page is displayed and not only the image.How could I display only the image?

2/I'd like to import some information (variable) from a distant html page.Could you please help me

Thanks[/img]
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

You can't control remote content. For all I know, they purposely generate full HTML when their files are remotely accessed, and if they don't provide a way for you to do what it is that you'd like to, chances are that you weren't meant to do so.

If you REALLY want to do it, javascript would be able to extract the elements that you want or remove the elements that you don't.
sarah2007
Forum Newbie
Posts: 2
Joined: Mon Apr 23, 2007 7:33 am

Post by sarah2007 »

Hi,

Thanks superdesign.I have full priveleges upon the remote server.the files are generated automatically by the MRTG tool (multirouter traffic graph)
I can save the images as "png" in a folder and then call them but the process is heavy as the graphs change each 5 min.

Thanks
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

superdezign wrote:You can't control remote content. For all I know, they purposely generate full HTML when their files are remotely accessed, and if they don't provide a way for you to do what it is that you'd like to, chances are that you weren't meant to do so.

If you REALLY want to do it, javascript would be able to extract the elements that you want or remove the elements that you don't.
file_get_contents(), preg_match()?
Post Reply