Changeset 320 for trunk/aktuality/import_zdechov_cz_aktuality.php
- Timestamp:
- Nov 27, 2011, 6:31:35 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/aktuality/import_zdechov_cz_aktuality.php
r310 r320 3 3 include('../global.php'); 4 4 5 $SourceURL = 'http://www.zdechov.cz/pages/main.php?pg=home&cat=1'; 6 $StartText = '<table width=100% border=0 cellspacing=1 cellpadding=5><tr><td bgcolor=#567069><b>'; 7 $TitleSeparator = '<tr>'; 8 $StartDescription = '<tr><td bgcolor=#567069>'; 9 $StartDate = 'vloženo: '; 5 $SourceURL = 'http://www.zdechov.cz/'; 6 $StartText = '<tr class="even">'; 7 $StartLink = 'href="'; 8 $StartTitle = '>'; 9 $TitleSeparator = '"'; 10 $StartDescription = ''; 11 $StartDate = '<td align="right">'; 10 12 $Category = 12; 11 13 $Author = 'Automat'; 12 13 $Content = addslashes(ToUTF8(file_get_contents($SourceURL), 'win1250')); 14 $Content = file_get_contents($SourceURL); 14 15 while(strpos($Content, $StartText) !== false) 15 16 { 16 17 $Content = substr($Content, strpos($Content, $StartText) + strlen($StartText)); 17 $Title = substr($Content, 0, strpos($Content, $TitleSeparator));18 $Content = substr($Content, strpos($Content, $StartDescription) + strlen($StartDescription));19 $Description = substr($Content, 0, strpos($Content, $TitleSeparator));20 18 $Content = substr($Content, strpos($Content, $StartDate) + strlen($StartDate)); 21 $Date = substr($Content, 0, strpos($Content, ' 19 $Date = substr($Content, 0, strpos($Content, '<')); 22 20 $DateParts = explode('.', $Date); 23 21 $Date = $DateParts[2].'-'.$DateParts[1].'-'.$DateParts[0]; 24 $Link = 'http://www.zdechov.cz/pages/main.php?pg=home&cat=1'; 22 $Content = substr($Content, strpos($Content, $StartLink) + strlen($StartLink)); 23 $Link = substr($Content, 0, strpos($Content, '"')); 24 if(substr($Link, 0, 7) != 'http://') $Link = 'http://'.$Link; 25 $Content = substr($Content, strpos($Content, $StartTitle) + strlen($StartTitle)); 26 $Title = substr($Content, 0, strpos($Content, '<')); 27 $Description = ''; 28 25 29 26 27 /*28 30 echo('Title: '.$Title.'<br>'); 29 31 echo('Description: '.$Description.'<br>'); 30 32 echo('Date: '.$Date.'<br>'); 31 33 echo('Link: '.$Link.'<br><hr>'); 32 */ 34 33 35 34 36 $DbResult = $Database->select('News', 'Id', '`Title`="'.$Database->real_escape_string($Title).'" AND `Date`="'.$Date.'" AND `Category`='.$Category);
Note:
See TracChangeset
for help on using the changeset viewer.