User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Ref another site's source code Page [1]  
Tingers
All American
747 Posts
user info
edit post

I need to parse through another site's source code and enter some of its text into my web site. How do I do this and have it update automatically when the original site updates?

3/12/2010 2:03:58 AM

Noen
All American
31346 Posts
user info
edit post

PHP + curl

3/12/2010 3:53:43 AM

FroshKiller
All American
51913 Posts
user info
edit post

Holy shit, it's Tingers.

3/12/2010 7:27:47 AM

darkone
(\/) (;,,,;) (\/)
11611 Posts
user info
edit post

perl + cron

[Edited on March 12, 2010 at 9:51 AM. Reason : forgot cron]

3/12/2010 9:50:58 AM

DeltaBeta
All American
9417 Posts
user info
edit post

PHP > Perl

Personal preference.

3/12/2010 10:28:36 AM

BigMan157
no u
103354 Posts
user info
edit post

PHP + get_file_contents + preg_replace/preg_match

3/12/2010 10:44:28 AM

DeltaBeta
All American
9417 Posts
user info
edit post

Also, a lot of sites get kinda pissy if you do that too much.

3/12/2010 11:09:35 AM

qntmfred
retired
40817 Posts
user info
edit post

^^ get_file_contents url access is often disabled on shared hosting.

go with curl

3/12/2010 11:40:34 AM

evan
All American
27701 Posts
user info
edit post

yeah

PHP + libcurl + the preg functions (or explode, if you're lazy)

^^that too. you might want to consider adding some caching logic.

3/12/2010 11:49:43 AM

Stein
All American
19842 Posts
user info
edit post

It's file_get_contents ( http://us.php.net/manual/en/function.file-get-contents.php ), rooks

However, it's the right answer unless (as qntmfred said) it's URL access is disabled.

A cron/caching wouldn't be a terrible idea either

[Edited on March 12, 2010 at 12:20 PM. Reason : Oh god, I'm too dumb to remember how to link ]

3/12/2010 12:19:35 PM

BigMan157
no u
103354 Posts
user info
edit post

I'm dyslexic words.

Also i broke into your office to watch Duke.

Sry.

3/12/2010 12:39:35 PM

Tingers
All American
747 Posts
user info
edit post

Thanks, I will try some of this today.

Really, I am not stealing. I am participating in a fundraiser and referencing the original site's current amount of funds raised. I have full permission to do this.

3/12/2010 6:57:06 PM

qntmfred
retired
40817 Posts
user info
edit post

^^^ aha, i thought it looked a little weird. i've been out of php for a while now

3/13/2010 4:09:51 PM

A Tanzarian
drip drip boom
10996 Posts
user info
edit post

If you know the people who run the site you're referencing, ask them to set up a page with only the funds raised on it (similar to whatismyip automation page: http://www.whatismyip.com/automation/n09230945.asp)

Saves then bandwidth and saves you some work.

3/14/2010 10:12:33 AM

Tingers
All American
747 Posts
user info
edit post

^ With over 10,000 people participating, I really don't think they are going to create a new page just for me, however it would be nice if they did.

3/14/2010 12:14:23 PM

A Tanzarian
drip drip boom
10996 Posts
user info
edit post

Can't hurt to ask.

As others have suggested, you probably want to avoid hitting their page every time someone hits yours.

3/14/2010 2:08:57 PM

smoothcrim
Universal Magnetic!
18968 Posts
user info
edit post

iframe dawg

3/15/2010 4:18:55 PM

FroshKiller
All American
51913 Posts
user info
edit post

oh smoothcrim

3/15/2010 4:32:45 PM

Tingers
All American
747 Posts
user info
edit post

Thanks guys, finally got the chance this weekend to mess around with it and got it working.

3/16/2010 11:11:51 AM

 Message Boards » Tech Talk » Ref another site's source code Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.