homepage Welcome to WebmasterWorld Guest from 54.166.65.9
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Grab html from remote webpage and post it to mysql database
lruneh




msg:3100903
 7:30 pm on Sep 28, 2006 (gmt 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.

 

lruneh




msg:3100977
 8:45 pm on Sep 28, 2006 (gmt 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 ;)

DrDoc




msg:3100979
 8:48 pm on Sep 28, 2006 (gmt 0)

Just use fopen [php.net]. It can open URLs in the same manner you would open a local file.

eelixduppy




msg:3101038
 9:25 pm on Sep 28, 2006 (gmt 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!

Psychopsia




msg:3101141
 10:38 pm on Sep 28, 2006 (gmt 0)

I use file [us2.php.net] and fsockopen [us2.php.net] to get RSS and XML files.

lruneh




msg:3102181
 5:10 pm on Sep 29, 2006 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved