Hi there,
Ive made a TV Guide scraper, that scrapes from SCC.
This is how it works
1) logs in to SCC using CuRL and cookiejar.
PHP Code:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $site);
curl_setopt($ch, CURLOPT_POSTFIELDS,'&username='.urlencode($username).'&password='.urlencode($password).'&submit=come on in');
curl_setopt($curl, CURLOPT_POSTFIELDS, $postVars);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
curl_exec($ch);
2) Then the second part of the CuRL script redirects to the tvguide page and writes the content of the tv guide page to a file called store.php
PHP Code:
$fp = fopen("include/store.php", "w");
curl_setopt($ch, CURLOPT_URL, $site2);
curl_setopt($ch, CURLOPT_HTTPGET, 1);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec($ch);
3) Now we need to get only the relative content from the file that was generated using DOM and then echo the reative information.
PHP Code:
$html = file_get_html("include/store.php");
foreach($html->find($tag) as $e)
$main = $e->innertext . '<br>';
3) Now we want to style the results according to your needs..
Install
1) Unpack rar
2) Copy
guide.php to your root folder.
3) Copy
guide.lang.php to include/langlanguages/english/ or the lang you use.
4) Copy
simple_html_dom.php and
conf.php to /include/
Config
Edit conf.php you added to your include folder.
and copy this to your template stylesheet
HTML Code:
#std_box_tv_content {
font-size: 10px;
}
.wrap {
border: thin solid #0F5C8E;
}
#std_box_wrapper #std_box_tv_content .tv_schedule_list .flag_float .small_middle {
background-color: #92CEEB;
}
#tv_schedule_list {
}
.tv_schedule_list_highlight {
background-color: #27CDD6;
display: block;
height: 15px;
font-weight: bolder;
color: #FFFFFF;
text-indent: 5px;
}
#std_box_tv_header {
font-size: 14px;
color: #0033FF;
text-indent: 5px;
}
#std_box_wrapper #std_box_tv_content .tv_schedule_list li {
background-color: #6CE1FF;
font-weight: bolder;
color: #0033CC;
text-indent: 5px;
}
#std_box_wrapper #std_box_tv_content .tv_schedule_list li a {
font-weight: bolder;
color: #00CCFF;
text-indent: 5px;
text-shadow: 1px 1px 1px #000; /* FF3.5+, Opera 9+, Saf1+, Chrome, IE10 */
font-size: 12px;
}
.theadmain {
color: #0033FF;
background-color: #00CCFF;
height: 25px;
}
.ping {
font-size: 10px;
font-weight: bolder;
}
#std_box_wrapper #std_box_tv_content .tv_schedule_list .tv_schedule_list_highlight {
font-weight: bold;
color: #FFFFFF;
background-color: #0066FF;
font-size: 14px;
text-indent: 5px;
}