Initial commit
This commit is contained in:
92
fetch_chorbuch/func_get_chorbuch.php
Normal file
92
fetch_chorbuch/func_get_chorbuch.php
Normal file
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
require_once("../config.inc.php");
|
||||
header("Content-Type: text/html; charset=utf-8");
|
||||
#echo "<pre>";
|
||||
/*
|
||||
CREATE TABLE `chorbuch` (
|
||||
`CBID` int(11) NOT NULL,
|
||||
`Nr` int(10) NOT NULL DEFAULT '0',
|
||||
`Titel` mediumtext COLLATE utf8_unicode_ci NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lieder im Chorbuch';
|
||||
|
||||
ALTER TABLE `chorbuch`
|
||||
ADD PRIMARY KEY (`CBID`);
|
||||
|
||||
ALTER TABLE `chorbuch`
|
||||
MODIFY `CBID` int(11) NOT NULL AUTO_INCREMENT;
|
||||
|
||||
CREATE TABLE `chorbuch_texte` (
|
||||
`CBID` int(11) NOT NULL,
|
||||
`Text` mediumtext COLLATE utf8_unicode_ci NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
truncate table chorbuch;
|
||||
truncate table chorbuch_texte;
|
||||
|
||||
*/
|
||||
|
||||
for($i=2897; $i<=3238; $i++){
|
||||
#echo "http://anonymouse.org/cgi-bin/anon-www_de.cgi/http://www.nak-gesangbuch.de/index.php?html=dechbhym$i<br>";
|
||||
$url = "http://anonymouse.org/cgi-bin/anon-www_de.cgi/http://www.nak-gesangbuch.de/index.php?html=dechbhym$i";
|
||||
$handle = file_get_contents($url);
|
||||
|
||||
# $handle=file_get_contents("testseite4.html");
|
||||
$handle = strstr($handle, '<div class="blogtitle"><h3>');
|
||||
$handle = strstr($handle, '<div class="clear"></div>', true);
|
||||
|
||||
# Headline H0
|
||||
$pos_ab = "27";
|
||||
$pos_bis = "";
|
||||
$handle2 = "";
|
||||
$handle3 = "";
|
||||
$text = "";
|
||||
$nummer = "";
|
||||
$headline = "";
|
||||
|
||||
|
||||
$handle2 = substr($handle, $pos_ab);
|
||||
$pos_bis = strpos($handle2, '</h3>');
|
||||
$name = trim(substr($handle2, 0, $pos_bis));
|
||||
$headteiler = explode(" ", $name);
|
||||
$nummer = trim($headteiler[0]);
|
||||
$headline = trim($headteiler[1]);
|
||||
|
||||
# Body
|
||||
$pos_ab2 = "22"; #<div class="blogtext">
|
||||
$handle3 = strstr($handle, '<div class="blogtext">');
|
||||
|
||||
$text = trim(substr($handle3, $pos_ab));
|
||||
#echo $text;
|
||||
$db = dbconnect();
|
||||
$db->query("SET NAMES 'utf8'");
|
||||
|
||||
$headline = $db->real_escape_string($headline);
|
||||
$text = $db->real_escape_string($text);
|
||||
|
||||
$sql1 = $db->query("INSERT INTO chorbuch ( Nr
|
||||
, Titel
|
||||
)
|
||||
VALUES
|
||||
( '$nummer'
|
||||
, '$headline'
|
||||
)");
|
||||
$cbid = $db->insert_id;
|
||||
|
||||
$sql1 = $db->query("INSERT INTO chorbuch_texte ( CBID
|
||||
, Text
|
||||
)
|
||||
VALUES
|
||||
( '$cbid'
|
||||
, '$text'
|
||||
)");
|
||||
|
||||
|
||||
# Zufällige Anzahl Sekunden pausieren
|
||||
# $random = rand(3, 10);
|
||||
# sleep($random);
|
||||
echo "$nummer --> $headline<br>";
|
||||
|
||||
|
||||
}
|
||||
#echo "</pre>";
|
||||
?>
|
Reference in New Issue
Block a user