Mr-Moo Posted October 8, 2007 Share Posted October 8, 2007 Hello everyone, I have been toying with php for roughly 1 year now, so I am familiar with what it looks like and how it acts, but am totally clueless on how to code. I have read a book written by Addison Wesley, but I am still dumb as a box of rocks. Here is what I am looking to do. I am trying to create a script that can grab information from a 3rd party website. For example, say I wanted to copy the text "Advertising Programs - Business Solutions - About Google" Off of Google's homepage. I wanted my website to open Google and select that text and output it onto my site. So if Google where to edit that information, it would also edit on my site. Anyone have any idea how to do this? I had a buddy who did that once with a Roster Rankings chart for IGN Gamespy Arena, but he ran off. Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/72378-remote-web-page-information/ Share on other sites More sharing options...
SammyGunnz Posted October 9, 2007 Share Posted October 9, 2007 file_get_contents() Quote Link to comment https://forums.phpfreaks.com/topic/72378-remote-web-page-information/#findComment-365025 Share on other sites More sharing options...
Mr-Moo Posted October 9, 2007 Author Share Posted October 9, 2007 Thanks for the quick reply! I tried to implement the command and I am running into an error. Here is what I put - <? $content=file_get_contents("http://www.google.com",FALSE,NULL,0,20); echo $content; ?> And this is what it outputs - Warning: file_get_contents() expects at most 2 parameters, 5 given in /local/home/test.php on line 2 Could you maybe provide some more information on why it is not working, or maybe how to be more specific on what it echos? Quote Link to comment https://forums.phpfreaks.com/topic/72378-remote-web-page-information/#findComment-365034 Share on other sites More sharing options...
SammyGunnz Posted October 9, 2007 Share Posted October 9, 2007 Just do... <?php $content = file_get_contents("http://google.com"); echo $content; ?> Quote Link to comment https://forums.phpfreaks.com/topic/72378-remote-web-page-information/#findComment-365037 Share on other sites More sharing options...
SammyGunnz Posted October 9, 2007 Share Posted October 9, 2007 That will get you started. Now that you have the page contents in the $content variable...you can get to looking for patterns or any specific text you want. Quote Link to comment https://forums.phpfreaks.com/topic/72378-remote-web-page-information/#findComment-365038 Share on other sites More sharing options...
Mr-Moo Posted October 9, 2007 Author Share Posted October 9, 2007 Hello SammyGunnz, I appreciate you working with me. I am not very good at php. Would you happen to have a site or something that helps me narrow down what it echos? How to be 'more' specific on what outputs. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/72378-remote-web-page-information/#findComment-365050 Share on other sites More sharing options...
SammyGunnz Posted October 9, 2007 Share Posted October 9, 2007 There are tons out there. You just have to know what you're looking for. Do some reading up on using 'regular expressions' (a.k.a "regex"). There are tons of sites with working examples. They can be tricky but come in handy for many many things. Quote Link to comment https://forums.phpfreaks.com/topic/72378-remote-web-page-information/#findComment-365055 Share on other sites More sharing options...
Mr-Moo Posted October 9, 2007 Author Share Posted October 9, 2007 Thank you very much for the help SammyGunnz. I will be scouring the internet for other methods to help narrow things down. Appreciate the help! I will keep you posted. Quote Link to comment https://forums.phpfreaks.com/topic/72378-remote-web-page-information/#findComment-365060 Share on other sites More sharing options...
RichardRotterdam Posted October 9, 2007 Share Posted October 9, 2007 I was wondering if the php DOMdocument function would work on that. It works great with javascripting Quote Link to comment https://forums.phpfreaks.com/topic/72378-remote-web-page-information/#findComment-365062 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.