[HELP]php grabber

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bla5e
Forum Contributor
Posts: 234
Joined: Tue May 25, 2004 4:28 pm

[HELP]php grabber

Post by bla5e »

How do i get PHP to grab infomation/text from another website??

(I want PHP to grab my teams score from caleague.com and post it on my teams website)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Combination of file_get_contents() and preg_match()
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

many different ways. probably the easiest would be do just do

Code: Select all

$data = file_get_contents('http://www.website_to_get.com');
then you are going to have to use some regex to get that desired information out of $data. that is definatly going to be the hardest part. post what you are looking to get out of it (like maybe the html where the information is) then someone can help you write that regex.

edit: sigh, i am getting too slow.
bla5e
Forum Contributor
Posts: 234
Joined: Tue May 25, 2004 4:28 pm

Post by bla5e »

shiznatix wrote:many different ways. probably the easiest would be do just do

Code: Select all

$data = file_get_contents('http://www.website_to_get.com');
post what you are looking to get out of it (like maybe the html where the information is) then someone can help you write that regex.

edit: sigh, i am getting too slow.

http://caleague.com/?page=teams&teamid=42842 = the website to get
Record <CHANGES> = data i want to get
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

then what you should do is ask someone to help you write a regex to do somtin like

Record <b>***this is what you want***</b><br/>

i would highly sugest posting in the regex forum when you post this, unless someone can quickly help the kid out? I don't know regex yet.
Deemo
Forum Contributor
Posts: 418
Joined: Sun Jan 18, 2004 11:48 am
Location: Washington DC

Post by Deemo »

when you use file_get_contents you get the entire code of the parsed PHP. Then you have to manually search through the contents of the file and then find where it says Record and then extract the data

damn beat me :x
Post Reply