Jump to content

[SOLVED] How do I get PHP to get web-page from another site?


Recommended Posts

In a browser, I can enter a URL and the remote server decides which HTML or PHP page to send back to my browser which is displayed nicely on my screen.

 

How do I get my PHP app to do a similar thing?

 

I want to be able to enter (say) www.blah.com and for the same page to come back to my PC so it can be stored on my disk as an HTML file.

 

Obviously, browsers know how to do this, and programs such as WinHTTrack make a fair job of it, but can it be done using PHP?

 

Thanks for looking.

Not really. Say I wanted to browse using IE whatever, to www.blah.com. The server will load what it thinks is the home page (say index.php), it gets PHP'ed and HTML comes back to my browser. If I wanted to, I could then save the source for that HTML on my PC.

 

Using PHP though, how would I get to do all that? I can't just ask the remote server for a file called index.html 'cos the html doesn't exist until the server-side PHP produces it. Somehow, I have to fool the server into getting it's PHP engine to produce my page of HTML.

 

Any ideas.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.