PHP Questions Home | Register | Login
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website
Unanswered

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

I would like to browse to a url eg http://mysite.com/index.html and dump the content of that site in a variable eg $htmlDump?


You will need to ensure that you have permission to do this from the site owner, because effectively you are indexing an entire web page by doing this. Remember that you will also be causing a load on a site, so you should do this on your site only, or if you will be using this to store/retrieve information from other websites you must ask their permission before doing so.

Anyhow, the PHP for this is very simple - you can just use the file_get_contents function like this:

<?php

$blah 
file_get_contents("the-url-goes-here");

//$blah now contains the content of that web page

?>



Comment on this Question and Answer >>>

ASK A QUESTION

More website PHP Questions

How to expire cookies when user pressed a button in webpage? I want have a link in my website then delete cookies.

How to find a domain name for an IP address?

How do I keep my site menu in one file?

How do I send HTTP headers with PHP?

how to get gmail inboxmessages in php using username and password



Custom Search