Welcome to WebmasterWorld Guest from 23.22.182.29

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Grab html from remote webpage and post it to mysql database

     
7:30 pm on Sep 28, 2006 (gmt 0)

New User

10+ Year Member

joined:July 19, 2005
posts:13
votes: 0


Hi all.

I'm trying to create a webpage where I can input a URL to a form. The page will then grab the html of the URL and put it in a mysql database.

I'de like to just make it clear that I am not at all trying to steal content. I'm trying to build a small searchable directory of websites. I need the html to search through.

I'm doing this for a friend, and unfortunately his site is on a linus server, so this particular part of the site has to be done in php - which I do not know...

Any help will be greatly appreciated. I really hope someone can help me with this.
thanks.

8:45 pm on Sept 28, 2006 (gmt 0)

New User

10+ Year Member

joined:July 19, 2005
posts:13
votes: 0


I'd be able to do this in asp with an HTTP get - but on a linux server, this is a no go...
It must be possible to put all the html into a variable and then put it in the data base. I just need to make this one page in php - the rest I can figure out by myself how to do in asp.
I can do the database bit, but I have no idea how to get the html from the remote webpage into a variable.
Come on folks - show me why php is better than asp ;)
8:48 pm on Sept 28, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 15, 2002
posts:6807
votes: 0


Just use fopen [php.net]. It can open URLs in the same manner you would open a local file.
9:25 pm on Sept 28, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 12, 2005
posts:5966
votes: 0


>>>It can open URLs in the same manner you would open a local file.

This is only if allow_url_fopen [us3.php.net] is enabled. If not, you must set it to 1 in your php.ini file.

Also, file_get_contents [us3.php.net] is another way to get your content.

Best of luck!

10:38 pm on Sept 28, 2006 (gmt 0)

Junior Member

5+ Year Member

joined:Apr 17, 2006
posts:195
votes: 0


I use file [us2.php.net] and fsockopen [us2.php.net] to get RSS and XML files.
5:10 pm on Sept 29, 2006 (gmt 0)

New User

10+ Year Member

joined:July 19, 2005
posts:13
votes: 0


Thank you very much for your help. It got me well on the way :-)
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members