content retrieval script

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
ferric
Forum Newbie
Posts: 16
Joined: Wed Mar 17, 2004 3:16 pm

content retrieval script

Post by ferric »

Hello,

i'm looing for a free script that will allow me to retrieve the show times located at this page: http://schedule.adultswim.com/servlet/S ... &filter=as

I've searched all over the web and have not found a script that works. Thanks
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

you should learn how to use regex..

every page is different, and will require the regex pattern to be tailored to work correctly. there is no one does all script for this.

but ill give you a nudge in the right direction

Code: Select all

<?php

$html = file_get_contents('http://website.com');

$pattern = '/<td>(.*)<\/td>/i';

preg_match_all($pattern, $html, $matches);



echo '<pre>';

print_r($matches);

?>
your going to need a much more complicated regex pattern for it to work properly, which, i cant help with.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Well put, you are going to need to know exackly how the tables are formatted, and then come up with a regular expression for each website you are retrieving the data from. You are then going to need to set up something like a chron job to update the site every 15 minutes or so for new listings.

helpful links: [php_man]regex[/php_man], [php_man]preg_match[/php_man]
Post Reply