honeybee
Goto Top

Webseite mit CURL aufrufen

Hallo,

kann man mit CURL eine Webseite (HTTP-URL) aufrufen und den Inhalt der Webseite gleich in der Shell als Output anzeigen lassen?

Content-Key: 1121454339

Url: https://administrator.de/contentid/1121454339

Printed on: April 18, 2024 at 16:04 o'clock

Member: Lochkartenstanzer
Lochkartenstanzer Aug 04, 2021 at 09:08:00 (UTC)
Goto Top
Moin,

 curl -vs google.com 2>&1 | less

oder was meintest Du?

lks
Member: honeybee
honeybee Aug 04, 2021 at 09:20:53 (UTC)
Goto Top
Wenn ich die Seite im Browser aufrufe, sieht es auf dem Bildschirm ungefähr so aus:

<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.axis.com/vapix/http_cgi/recording/continuousconfigurationadd1.xsd">  
<configure profile="11" result="OK"/>  
</root>

Die Frage ist, ob ich diese Ausgabe auch im Kommandofenster anzeigen kann, wenn ich die URL aufrufe.

Beim Versuch, das zu tun, sieht es so aus, also völlig andere Ausgabe:

*   Trying xxx.xxx.xxx.xxx...
* Connected to xxx.domain.com (xxx) port 80 (#0)
> GET /axis-cgi/record/continuous/addconfiguration.cgi?diskid=NetworkShare HTTP/1.1
> User-Agent: curl/7.29.0
> Host: xxx
> Accept: */*
>
< HTTP/1.1 302 Found
< Date: Wed, 04 Aug 2021 09:13:49 GMT
< Server: Apache/2.4.46 (Unix) OpenSSL/1.1.1k
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< X-XSS-Protection: 1; mode=block
< Location: https://xxx/axis-cgi/record/continuous/addconfiguration.cgi?diskid=NetworkShare
< Content-Length: 284
< Content-Type: text/html; charset=iso-8859-1
<
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">  
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://xxx/axis-cgi/record/continuous/addconfiguration.cgi?diskid=NetworkShare">here</a>.</p>  
</body></html>
* Connection #0 to host xxx left intact
Member: LordGurke
LordGurke Aug 04, 2021 updated at 09:34:24 (UTC)
Goto Top
Das ist eine Umleitung vom Server, mutmaßlich auf eine HTTPS-Version.
Hast du CURL explizit eine HTTPS-URI gegeben? Wenn nicht, schreibe explizit mal "https://" davor.
Member: BirdyB
Solution BirdyB Aug 04, 2021 at 09:49:03 (UTC)
Goto Top
Moin,

hast du curl mal den Parameter -L mitgegeben? Dann sollten Redirects aufgelöst werden...
Siehe hier: https://everything.curl.dev/http/redirects#:~:text=In%20curl's%20tr ....

VG