import von xml daten mit hilfe von fsockopen implementiert
git-svn-id: svn://svn.cccv.de/engel-system@161 29ba0400-6e00-0410-a75a-ca02368028f8
This commit is contained in:
parent
c8713d0218
commit
ffa84f39e7
5
README
5
README
|
@ -14,3 +14,8 @@ Systemconfig:
|
||||||
./www-ssl/inc/db.php
|
./www-ssl/inc/db.php
|
||||||
einstellungen der DB
|
einstellungen der DB
|
||||||
Achtung: DB user braucht folgende Rechte: SELECT, CREATE, INSERT, ALTER, UPDATE, INDEX, DELETE, DROP
|
Achtung: DB user braucht folgende Rechte: SELECT, CREATE, INSERT, ALTER, UPDATE, INDEX, DELETE, DROP
|
||||||
|
|
||||||
|
php.ini:
|
||||||
|
--------
|
||||||
|
add:
|
||||||
|
allow_url_fopen = On
|
||||||
|
|
|
@ -38,6 +38,8 @@ $ModemEnable = false;
|
||||||
$Tempdir="/tmp";
|
$Tempdir="/tmp";
|
||||||
|
|
||||||
//Pentabarf ConferenzDI für UpdateDB
|
//Pentabarf ConferenzDI für UpdateDB
|
||||||
$PentabarXCALurl="https://pentabarf.cccv.de/xcal/conference/<ConfereneceID>";
|
$PentabarfXMLhost = "pentabarf.cccv.de";
|
||||||
|
$PentabarfXMLpath = "Xcal/conference/";
|
||||||
|
$PentabarfXMLEventID = "31";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -47,35 +47,59 @@ if( isset($_POST["PentabarfUser"]) && isset($_POST["password"]) && isset($_POST[
|
||||||
{
|
{
|
||||||
echo "Update XCAL-File from Pentabarf..";
|
echo "Update XCAL-File from Pentabarf..";
|
||||||
|
|
||||||
//user uns password in url einbauen
|
|
||||||
$FileNameIn = "pentabarf.cccv.de";/*.
|
|
||||||
$_POST["PentabarfUser"]. ":".
|
|
||||||
$_POST["password"]. "@".
|
|
||||||
$_POST["PentabarfURL"];*/
|
|
||||||
//backup error messeges and delate
|
//backup error messeges and delate
|
||||||
$Backuperror_messages = $error_messages;
|
$Backuperror_messages = $error_messages;
|
||||||
$fp = fsockopen( $FileNameIn, 443, $errno, $errstr, 30);
|
$fp = fsockopen( "ssl://$PentabarfXMLhost", 443, $errno, $errstr, 30);
|
||||||
$error_messages = $Backuperror_messages;
|
$error_messages = $Backuperror_messages;
|
||||||
|
|
||||||
if( !$fp)
|
if( !$fp)
|
||||||
{
|
{
|
||||||
echo "<h2>fail: File 'ssl://". $_POST["PentabarfURL"]. "' not readable!</h2>".
|
echo "<h2>fail: File 'https://$PentabarfXMLhost/$PentabarfXMLpath$PentabarfXMLEventID' not readable!".
|
||||||
"[$errstr ($errno)]<br>\n";
|
"[$errstr ($errno)]</h2>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if( ($fileOut = fopen( "$Tempdir/engelXML", "w")) != FALSE)
|
if( ($fileOut = fopen( "$Tempdir/engelXML", "w")) != FALSE)
|
||||||
if( 1)
|
|
||||||
{
|
{
|
||||||
fputs( $fp, "GET / HTTP/1.0\r\n\r\n");
|
$head = 'GET /'. $PentabarfXMLpath. $PentabarfXMLEventID. ' HTTP/1.1'."\r\n".
|
||||||
$Zeilen = 0;
|
'Host: '. $PentabarfXMLhost. "\r\n".
|
||||||
|
'User-Agent: Engelsystem'. "\r\n".
|
||||||
|
'Authorization: Basic '.
|
||||||
|
base64_encode($_POST["PentabarfUser"]. ':'. $_POST["password"])."\r\n".
|
||||||
|
"\r\n";
|
||||||
|
fputs( $fp, $head);
|
||||||
|
$Zeilen = -1;
|
||||||
while (!feof($fp))
|
while (!feof($fp))
|
||||||
{
|
{
|
||||||
$Zeilen++;
|
$Temp= fgets($fp,1024);
|
||||||
// fputs( $fileOut, fgets($fp,128));
|
|
||||||
echo fgets($fp,128);
|
// ende des headers
|
||||||
|
if( $Temp== "f20\r\n" )
|
||||||
|
{
|
||||||
|
$Zeilen = 0;
|
||||||
|
$Temp="";
|
||||||
|
}
|
||||||
|
|
||||||
|
//file ende?
|
||||||
|
if( $Temp=="0\r\n")
|
||||||
|
break;
|
||||||
|
|
||||||
|
if( ($Zeilen>-1) && ($Temp!="ffb\r\n") )
|
||||||
|
{
|
||||||
|
//steuerzeichen ausfiltern
|
||||||
|
if( strpos( "#$Temp", "\r\n") > 0)
|
||||||
|
$Temp = substr($Temp, 0, strlen($Temp)-2);
|
||||||
|
if( strpos( "#$Temp", "1005") > 0)
|
||||||
|
$Temp = "";
|
||||||
|
if( strpos( "#$Temp", "783") > 0)
|
||||||
|
$Temp = "";
|
||||||
|
//schreiben in file
|
||||||
|
fputs( $fileOut, $Temp);
|
||||||
|
$Zeilen++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// fclose( $fileOut);
|
fclose( $fileOut);
|
||||||
|
|
||||||
echo "<br>Es wurden $Zeilen Zeilen eingelesen<br>";
|
echo "<br>Es wurden $Zeilen Zeilen eingelesen<br>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -87,9 +111,9 @@ else
|
||||||
{
|
{
|
||||||
echo "<form action=\"dbUpdateFromXLS.php\" method=\"post\">\n";
|
echo "<form action=\"dbUpdateFromXLS.php\" method=\"post\">\n";
|
||||||
echo "<table border=\"0\">\n";
|
echo "<table border=\"0\">\n";
|
||||||
echo "\t<tr><td>XCAL-File: https://</td>".
|
echo "\t<tr><td>XCAL-File: https://$PentabarfXMLhost/$PentabarfXMLpath</td>".
|
||||||
"<td><input name=\"PentabarfURL\" type=\"text\" size=\"100\" maxlength=\"1000\" ".
|
"<td><input name=\"PentabarfURL\" type=\"text\" size=\"4\" maxlength=\"5\" ".
|
||||||
"value=\"$PentabarXCALurl\"></td></tr>\n";
|
"value=\"$PentabarfXMLEventID\"></td></tr>\n";
|
||||||
echo "\t<tr><td>Username:</td>".
|
echo "\t<tr><td>Username:</td>".
|
||||||
"<td><input name=\"PentabarfUser\" type=\"text\" size=\"30\" maxlength=\"30\"></td></tr>\n";
|
"<td><input name=\"PentabarfUser\" type=\"text\" size=\"30\" maxlength=\"30\"></td></tr>\n";
|
||||||
echo "\t<tr><td>Password:</td>".
|
echo "\t<tr><td>Password:</td>".
|
||||||
|
|
Loading…
Reference in New Issue