#!/usr/bin/perl use strict; use warnings; use IO::Socket; use IO::File; my $host = "149.210.139.172"; my $port = "8200"; my $CRLF = "\r\n"; my $file = "radio19.mp3"; my $size = 300000; # ca 14 Sekunden # HTTP Request an Radio 19 International my $s = IO::Socket::INET->new("$host:$port") or die $@; $s->print("GET /standard?icy=http HTTP/1.0$CRLF"); $s->print("Host: $host$CRLF$CRLF"); # mp3 Datei anlegen my $fh = IO::File->new; $fh->open($file, O_CREAT|O_BINARY|O_RDWR|O_TRUNC) or die $!; # Socket lesen und mp3 Datei beschreiben my $c = 0; while( $c += read($s, my $buffer, 1) ){ $fh->print($buffer); last if $c > $size; } # # http://149.210.139.172:8200/standard?icy=http