[Problem] betr. Anzeige eines Scripts

S

SF1975

Guest
Hallo,
Ich habe versucht, 4 Scripte in einem zusammen zu fassen.
Leider "verschwindet" die Anzeige sehr oft und "kommt nur sporadisch" zurück:
So soll es aussehen: Anhang anzeigen 81739, so sieht es sehr oft aus: Anhang anzeigen 81740.

Ich habe versucht, diese 4 Scripte (Anhang anzeigen 81741) in diesem zusammen zu fassen:
psgFBF-7390.php
PHP:
<?php

    /*

    +---------------------------------------------------------------------+
        |                                                                     |
        |   SensorAndSwitch Automation Pro                                    |
        |   PseudoGeräte-Script                                               |
        |   ===============================================================   |
        |   -> SIP                                                            |
        |   Fritz!Box Anrufbeantworter / Rufnummern / WLAN / Mediapl.-WebDAV  |
        |                                                                     |
        +---------------------------------------------------------------------+
    */

    include __DIR__."/../include/psg.php";

    $Login=$Conf["FB"]."/login_sid.lua";
    $user=$Conf["USER"];
    $password=$Conf["PASSWORD"];
    /*
    Anrufbeantworter
    */
    $url=$Conf["FB"]."/query.lua?sid=".GetSessionID($Login,$user,$password)."&wlan=tam:settings/TAM0/Active";
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $Status1 = curl_exec($ch);
    curl_close($ch);
    $Login=$Conf["FB"]."/login_sid.lua";
    $user=$Conf["USER"];
    $password=$Conf["PASSWORD"];
    $url=$Conf["FB"]."/query.lua?sid=".GetSessionID($Login,$user,$password)."&wlan=tam:settings/TAM1/Active";
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $Status2 = curl_exec($ch);
    curl_close($ch);
    $Login=$Conf["FB"]."/login_sid.lua";
    $user=$Conf["USER"];
    $password=$Conf["PASSWORD"];
    $url=$Conf["FB"]."/query.lua?sid=".GetSessionID($Login,$user,$password)."&wlan=tam:settings/TAM2/Active";
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $Status3 = curl_exec($ch);
    curl_close($ch);
    $ab1="2";
    $ab2="2";
    $ab3="2";
    $x1=explode('"',$Status1);
    if ($x1[3]=="0" or $x1[3]=="1") {
        $ab1=$x1[3];
    }
    $x2=explode('"',$Status2);
    if ($x2[3]=="0" or $x2[3]=="1") {
        $ab2=$x2[3];
    }
    $x3=explode('"',$Status3);
    if ($x3[3]=="0" or $x3[3]=="1") {
        $ab3=$x3[3];
    }
    /*
    Rufnummern
    */
    $url=$Conf["FB"]."/query.lua?sid=".GetSessionID($Login,$user,$password)."&wlan=sip:status/sip7/connect";
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $Status1 = curl_exec($ch);
    curl_close($ch);
    $Login=$Conf["FB"]."/login_sid.lua";
    $user=$Conf["USER"];
    $password=$Conf["PASSWORD"];
    $url=$Conf["FB"]."/query.lua?sid=".GetSessionID($Login,$user,$password)."&wlan=sip:status/sip9/connect";
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $Status2 = curl_exec($ch);
    curl_close($ch);
    $Login=$Conf["FB"]."/login_sid.lua";
    $user=$Conf["USER"];
    $password=$Conf["PASSWORD"];
    $url=$Conf["FB"]."/query.lua?sid=".GetSessionID($Login,$user,$password)."&wlan=sip:status/sip8/connect";
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $Status3 = curl_exec($ch);
    curl_close($ch);
    $Login=$Conf["FB"]."/login_sid.lua";
    $user=$Conf["USER"];
    $password=$Conf["PASSWORD"];
    $url=$Conf["FB"]."/query.lua?sid=".GetSessionID($Login,$user,$password)."&wlan=sip:status/sip14/connect";
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $Status4 = curl_exec($ch);
    curl_close($ch);
    $Login=$Conf["FB"]."/login_sid.lua";
    $user=$Conf["USER"];
    $password=$Conf["PASSWORD"];
    $url=$Conf["FB"]."/query.lua?sid=".GetSessionID($Login,$user,$password)."&wlan=sip:status/sip15/connect";
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $Status5 = curl_exec($ch);
    curl_close($ch);
    $t1="2";
    $t2="2";
    $t3="2";
    $t4="2";
    $t5="2";
    $x1=explode('"',$Status1);
    if ($x1[3]=="1" or $x1[3]=="2") {
        $t1=$x1[3]-1;
    }
    $x2=explode('"',$Status2);
    if ($x2[3]=="1" or $x2[3]=="2") {
        $t2=$x2[3]-1;
    }
    $x3=explode('"',$Status3);
    if ($x3[3]=="1" or $x3[3]=="2") {
        $t3=$x3[3]-1;
    }
    $x4=explode('"',$Status4);
    if ($x4[3]=="1" or $x4[3]=="2") {
        $t4=$x4[3]-1;
    }
    $x5=explode('"',$Status5);
    if ($x5[3]=="1" or $x5[3]=="2") {
        $t5=$x5[3]-1;
    }
    /*
    WLAN
    */
    $url=$Conf["FB"]."/query.lua?sid=".GetSessionID($Login,$user,$password)."&wlan=wlan:status/ap_enabled";
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $Status1 = curl_exec($ch);
    curl_close($ch);
    $Login=$Conf["FB"]."/login_sid.lua";
    $user=$Conf["USER"];
    $password=$Conf["PASSWORD"];
    $url=$Conf["FB"]."/query.lua?sid=".GetSessionID($Login,$user,$password)."&wlan=wlan:status/ap_enabled_scnd";
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $Status2 = curl_exec($ch);
    curl_close($ch);
    $Login=$Conf["FB"]."/login_sid.lua";
    $user=$Conf["USER"];
    $password=$Conf["PASSWORD"];
    $url=$Conf["FB"]."/query.lua?sid=".GetSessionID($Login,$user,$password)."&wlan=wlan:status/guest_ap_enabled";
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $Status3 = curl_exec($ch);
    curl_close($ch);

    $wl1="2";
    $wl2="2";
    $wl3="2";
    $x1=explode('"',$Status1);
    if ($x1[3]=="0" or $x1[3]=="1") {
        $wl1=$x1[3];
    }
    $x2=explode('"',$Status2);
    if ($x2[3]=="0" or $x2[3]=="1") {
        $wl2=$x2[3];
    }
    $x3=explode('"',$Status3);
    if ($x3[3]=="0" or $x3[3]=="1") {
        $wl3=$x3[3];
    }
    
    /*
    Media
    */
    $url=$Conf["FB"]."/query.lua?sid=".GetSessionID($Login,$user,$password)."&wlan=mediasrv:settings/enabled";
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $Status1 = curl_exec($ch);
    curl_close($ch);
    $Login=$Conf["FB"]."/login_sid.lua";
    $user=$Conf["USER"];
    $password=$Conf["PASSWORD"];
    $url=$Conf["FB"]."/query.lua?sid=".GetSessionID($Login,$user,$password)."&wlan=webdavclient:status/connection_state";
    $ch = curl_init();
    $timeout = 5;
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
    curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $Status2 = curl_exec($ch);
    curl_close($ch);
    $mm1="2";
    $mm2="2";
    $x1=explode('"',$Status1);
    if ($x1[3]=="0" or $x1[3]=="1") {
        $mm1=$x1[3];
    }
    $x2=explode('"',$Status2);
    if ($x2[3]=="0" or $x2[3]=="1") {
        $mm2=$x2[3];
    }

    /*
    Anzeige
    */
    echo 'P#<div style="font-size:20px;text-align:right;width:320px;position:absolute;top:-5px;"><img src="'.picdesign("work1.gif").'" border="0"></div><div style="font-size:16px;text-align:right;width:260px;position:absolute;top:-1px;"><div>AB: <img src="'.picdesign("mled".$ab1.".png").'" height="15px"><img src="'.picdesign("mled".$ab2.".png").'" height="15px"><img src="'.picdesign("mled".$ab3.".png").'" height="15px"> SIP: <img src="'.picdesign("mled".$t1.".png").'" height="15px"><img src="'.picdesign("mled".$t2.".png").'" height="15px"><img src="'.picdesign("mled".$t3.".png").'" height="15px">&<img src="'.picdesign("mled".$t4.".png").'" height="15px"><img src="'.picdesign("mled".$t5.".png").'" height="15px"><br>WLAN: <img src="'.PIC.'mled'.$wl1.'.png" height="15px"><img src="'.PIC.'mled'.$wl2.'.png" height="15px"><img src="'.PIC.'mled'.$wl3.'.png" height="15px"> Media/DAV: <img src="'.PIC.'mled'.$mm1.'.png" height="15px"><img src="'.PIC.'mled'.$mm2.'.png" height="15px"></div>*HTML#';
    exit;
    
?>
Vielleicht hat ja einer von Euch eine Idee :noidea:

So aufgeteilt laufen sie problemlos:
Anhang anzeigen 81744

[EDIT]
zu früh gefreut....
Anhang anzeigen 81745
 
Zuletzt bearbeitet von einem Moderator:
Bei zu vielen Abfragen innerhalb eines Scripts ist die Antwortzeit des Webservers wohl zu lang. Das Symbol zeigt, dass das psg nicht geantwortet hat. Passiert auch bei mir. In den Tiefen des apache2 gibt es sicher noch Einstellmöglichkeiten, aber habe nicht die passende Einstellung gefunden, Daher überlade ich dann lieber meine Scripte nicht so, dass es zum Timeout kommt. Das Wetterscript ist auch so ein ekliger Kandidat. Da bricht auch öfter mal das psg-Script einfach ab und liefert nichts.

Sobald ich die Stelle im apache2 finde, poste ich das hier, weil mich das auch manchmal nervt. ;)

Eine kleine Abhilfe ist statt E## das Pseudo C## zu verwenden. Kannst es mal probieren. ;)
Aber wie ich sehe, hast du keine Fehlerbehandlung und das Script wird vom apache einfach nur gecancelt. Bei so vielen curl kein Wunder. Jeder 5 Sekunden, das sind im schlechtesten Fall mehr als 30 Sekunden... Das wird eng.
 
Zuletzt bearbeitet:
Hallo,
;) Das ist sicherlich meinem fehlenden Wissen geschuldet ;) Deswegen ja auch meine nervenden Fragen :)
 
Das ist kein Problem. :)
Das Problem ist, dass ichs auch nicht weiß, wie mans abstellt. ;)

Eben gerade auf der Suche gefunden, dass in die /etc/apache2/apache2.conf unter "# Global configuration" noch "ServerName localhost" muss, dass er beim Reboot vom apache2 nicht immer eine Warnung bringt:
# Global configuration
#
ServerName localhost


* Nachtrag
 
Zuletzt bearbeitet:
Nein, mein Fehler: /etc/apache2/apache2.conf.
 

Zurzeit aktive Besucher

Statistik des Forums

Themen
244,827
Beiträge
2,219,005
Mitglieder
371,520
Neuestes Mitglied
fredl_2
Holen Sie sich 3CX - völlig kostenlos!
Verbinden Sie Ihr Team und Ihre Kunden Telefonie Livechat Videokonferenzen

Gehostet oder selbst-verwaltet. Für bis zu 10 Nutzer dauerhaft kostenlos. Keine Kreditkartendetails erforderlich. Ohne Risiko testen.

3CX
Für diese E-Mail-Adresse besteht bereits ein 3CX-Konto. Sie werden zum Kundenportal weitergeleitet, wo Sie sich anmelden oder Ihr Passwort zurücksetzen können, falls Sie dieses vergessen haben.