Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. [gelöst] ICS Datei von WebSeite lesen

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    [gelöst] ICS Datei von WebSeite lesen

    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      stoffel67 last edited by

      Hallo,

      was mach' ich hier falsch:

      function lese_ICAL() {
          var request = require('request');
              var theUrl="https://www.baden-baden.de/buergerservice/umwelt/entsorgung/umweltkalender/?ort=5&strasse=1&abfallart[]=1&abfallart[]=2&abfallart[]=3&abfallart[]=5&abfallart[]=6&abfallart[]=4&t=1&pdf=3";
              request(theUrl,function(error,response,body){
              console.log(body);
          });
      }
      lese_ICAL()
      
      

      wenn ich die URL in des IE eingebe, dann bekomm' ich die Datei

      bin ratlos…

      1 Reply Last reply Reply Quote 0
      • apollon77
        apollon77 last edited by

        Und was bekommst Du mit dem Code?

        Was steht in response ("console.log(JSON.stringify(response));")? Was steht in error?

        1 Reply Last reply Reply Quote 0
        • S
          stoffel67 last edited by

          im response:
          ` > javascript.0 script.js.common.Skript4: {"statusCode":200,"body":"

          \nFatal error: Uncaught exception 'InvalidArgumentException' with message 'parse_user_agent requires a user agent' in /kunden/216314_76532/rp-hosting/K165540/A136895/webseiten/www.baden-baden.de/htdocs/inc/useragent … :18\nStack trace:\n#0 /kunden/216314_76532/rp-hosting/K165540/A136895/webseiten/http://www.baden-baden.de/htdocs/inc/stadt.class.inc.php%281448%29: parse_user_agent()\n#1 /kunden/216314_76532/rp-hosting/K165540/A136895/webseiten/http://www.baden-baden.de/htdocs/inc/stadt.class.inc.php%2862%29: StadtClass->checkBrowserIsValid()\n#2 /kunden/216314_76532/rp-hosting/K165540/A136895/webseiten/http://www.baden-baden.de/htdocs/inc/page_scripts.inc.php%284%29: StadtClass->initPage()\n#3 /kunden/216314_76532/rp-hosting/K165540/A136895/webseiten/http://www.baden-baden.de/htdocs/buergerservice/index.php%283%29: include_once('/kunden/216314_...')\n#4 {main}\n thrown in /kunden/216314_76532/rp-hosting/K165540/A136895/webseiten/www.baden-baden.de/htdocs/inc/useragent ... er.inc.php on line 18

          \n","headers":{"date":"Thu, 22 Mar 2018 11:12:46 GMT","server":"Apache/2.4.29","x-powered-by":"PHP/5.4.45","expires":"Thu, 19 Nov 1981 08:52:00 GMT","cache-control":"no-store, no-cache, must-revalidate, post-check=0, pre-check=0","pragma":"no-cache","vary":"Accept-Encoding","content-type":"text/html","set-cookie":["PHPSESSID=2220e91875befdb17ca40703958347bf; path=/"],"connection":"close","transfer-encoding":"chunked"},"request":{"uri":{"protocol":"https:","slashes":true,"auth":null,"host":"www.baden-baden.de","port":443,"hostname":"www.baden-baden.de","hash":null,"search":"?ort=5&strasse=1&abfallart[]=1&abfallart[]=2&abfallart[]=3&abfallart[]=5&abfallart[]=6&abfallart[]=4&t=1&pdf=3","query":"ort=5&strasse=1&abfallart[]=1&abfallart[]=2&abfallart[]=3&abfallart[]=5&abfallart[]=6&abfallart[]=4&t=1&pdf=3","pathname":"/buergerservice/umwelt/entsorgung/umweltkalender/","path":"/buergerservice/umwelt/entsorgung/umweltkalender/?ort=5&strasse=1&abfallart[]=1&abfallart[]=2&abfallart[]=3&abfallart[]=5&abfallart[]=6&abfallart[]=4&t=1&pdf=3","href":"https://www.baden-baden.de/buergerservice/umwelt/entsorgung/umweltkalender/?ort=5&strasse=1&abfallart[]=1&abfallart[]=2&abfallart[]=3&abfallart[]=5&abfallart[]=6&abfallart[]=4&t=1&pdf=3"},"method":"GET","headers":{}}} `

          1 Reply Last reply Reply Quote 0
          • apollon77
            apollon77 last edited by

            LOL … der Webserver beschwert sich das du den Call nichgt von einem echten Browser machst.

            Schau mal hier wie Du z.B. den fehlenden user-Agent setzen könntest: https://github.com/request/request#custom-http-headers.

            Musst dann schauen was er ggf noch mehr meckert

            1 Reply Last reply Reply Quote 0
            • S
              stoffel67 last edited by

              Super,

              das war der entscheidende Hinweis
              > 'User-Agent': ' Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko',

              Vielen Dank…

              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              Support us

              ioBroker
              Community Adapters
              Donate

              848
              Online

              31.7k
              Users

              79.8k
              Topics

              1.3m
              Posts

              2
              5
              349
              Loading More Posts
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes
              Reply
              • Reply as topic
              Log in to reply
              Community
              Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
              The ioBroker Community 2014-2023
              logo