Changeset 321 for trunk/aktuality/import_zdechov_cz_zapisy.php
- Timestamp:
- Nov 27, 2011, 6:47:46 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/aktuality/import_zdechov_cz_zapisy.php
r310 r321 3 3 include('../global.php'); 4 4 5 $SourceURL = 'http://www.zdechov.cz/pages/main.php?pg=ou-usneseni-zapisy&ax=arx'; 6 $StartText = '<b>Dokument:</b> '; 7 $TitleSeparator = '<br> '; 8 $StartLink = '<a href=..'; 5 $SourceURL = 'http://www.zdechov.cz/?page=uredni_deska'; 6 $StartText = '<tr class="even">'; 7 $StartLink = 'href="'; 8 $StartTitle = '>'; 9 $TitleSeparator = '"'; 10 $StartDescription = ''; 11 $StartDate = '<td align="right">'; 9 12 $Category = 11; 10 13 $Author = 'Automat'; 11 12 $Content = addslashes(ToUTF8(file_get_contents($SourceURL), 'win1250')); 14 $Content = file_get_contents($SourceURL); 13 15 while(strpos($Content, $StartText) !== false) 14 16 { 15 17 $Content = substr($Content, strpos($Content, $StartText) + strlen($StartText)); 16 $ Title = substr($Content, 0, strpos($Content, $TitleSeparator));17 $Date = substr($ Title, strrpos($Title, ' ') + 1);18 $DateParts = explode(' -', $Date);18 $Content = substr($Content, strpos($Content, $StartDate) + strlen($StartDate)); 19 $Date = substr($Content, 0, strpos($Content, '<')); 20 $DateParts = explode('.', $Date); 19 21 $Date = $DateParts[2].'-'.$DateParts[1].'-'.$DateParts[0]; 20 22 $Content = substr($Content, strpos($Content, $StartLink) + strlen($StartLink)); 21 $Link = 'http://www.zdechov.cz'.substr($Content, 0, strpos($Content, ' ')); 22 $Link = substr($Link, 0, strpos($Link, '?')); // Remove URL parameters 23 $Link = substr($Link, 0, strrpos($Link, '/')).$DateParts[1].substr($Link, strrpos($Link, '/')); // Insert month between folder and filename 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, '<')); 24 27 $Description = ''; 28 25 29 26 /*30 /* 27 31 echo('Title: '.$Title.'<br>'); 28 32 echo('Description: '.$Description.'<br>'); 29 33 echo('Date: '.$Date.'<br>'); 30 34 echo('Link: '.$Link.'<br><hr>'); 31 */35 */ 32 36 33 37 $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.