Current location: Hot Scripts Forums » Programming Languages » PHP » Grabbing Content From A Specific Website


Grabbing Content From A Specific Website

Reply
  #1 (permalink)  
Old 07-10-08, 08:54 PM
coxy66 coxy66 is offline
New Member
 
Join Date: Jul 2008
Location: leeds, UK
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Grabbing Content From A Specific Website

NOTE : Sorry if this is in the wrong forum? I wasn't sure so I just put it here.

Hey guys, long time lurker. I've been teaching myself a bit of basic php through this site for a while now (I just search through the forum to find some helpful scripts ideas, lol). I was wondering if you guys could help me out with a little something?

Basically, i've set up a trial website (based around a Goal Line Blitz football team) - www.ottawa-rapids.co.nr that i'm going to try to start scripting with. I'm trying to find out if I can just grab a piece of information from another website everytime it updates itself. For example "tackles" on this page : http://goallineblitz.com/game/player...ayer_id=189296. I'm pretty sure this is probably obvious to most of you guys, but i'm a total noob with this stuff, sorry. Anyway, I was wondering if one of you kind souls could possibly walk me through how to do this? BEWARE - I class myself as a complete beginner, lol.

Thanks in advance guys!
Reply With Quote
  #2 (permalink)  
Old 07-11-08, 03:19 AM
hansk's Avatar
hansk hansk is offline
Newbie Coder
 
Join Date: Jul 2008
Location: Czech republic
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Grabbing content

Hi,
I guess the only way to do this, is to load the source code of the page into a variable using the file_get_content() function and parse the text out by string functions or/and regular expressions. Unfortunately this won't probably work on the link you posted, beacuse you need to be registred to view that page. Hope I helped you.

Last edited by hansk; 07-11-08 at 03:41 AM.
Reply With Quote
  #3 (permalink)  
Old 07-11-08, 07:36 AM
coxy66 coxy66 is offline
New Member
 
Join Date: Jul 2008
Location: leeds, UK
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Ah okay I see. Thanks for that mate, yeah. You did help me
Reply With Quote
  #4 (permalink)  
Old 07-12-08, 12:37 AM
theighost theighost is offline
Newbie Coder
 
Join Date: Jul 2008
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
well you can study curl functions which allow you to save a foreign web page as your own page at your own server thus control it as your own...

after saving it to ur sever use fopen to take data from it..and use strpos and substr to specify the exact location.

i will give you the exact code to help you save the page to your server,anyway...you will have to find a way to login !

PHP Code:

$ch curl_init();
curl_setopt($chCURLOPT_URL,"htt[://the-domain-u-want-to-open.com");
curl_setopt($chCURLOPT_RETURNTRANSFER,1); // return into a variable
curl_setopt($chCURLOPT_TIMEOUT3); // times out after 4s
curl_setopt($chCURLOPT_POST1); // set POST method
curl_setopt($chCURLOPT_POSTFIELDS"f=mysearchstring");
curl_setopt ($chCURLOPT_FOLLOWLOCATION1);
$result =curl_exec ($ch);
curl_close ($ch);
  
$fp=fopen("name-of-file-u-want-to-save-on-ur-server.php",w);
  
fwrite($fp,$result); 
if you open the file "name-of-file-u-want-to-save-on-ur-server" like this: http://www.my-domain.com/name-of-fil...-ur-server.php

you will see that it displays the exact info on the other site without redirecting you there.

after this as i told you u open the file and take the info you want.

you may want to refresh your page often so use a loop or something

regards!

Last edited by Nico; 07-12-08 at 02:11 AM. Reason: Please use [php] wrappers when posting PHP code.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
100 ways to get more traffic jorokolarov The Lounge 12 12-06-07 07:20 PM
Complete ringtone website with top features! rossy790 General Advertisements 6 06-29-05 08:06 AM
Complete website made. Ready for business rossy790 General Advertisements 0 03-04-05 06:03 PM
Error On Registeration timmy408 ASP 2 09-05-04 02:53 PM
FS: Prozilla Memberships (Turnkey Sites) - $10-15 less than Retail! rockergrrl General Advertisements 0 08-11-04 12:05 AM


All times are GMT -5. The time now is 07:49 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.