<?php

function DownloadUrl($url)
{
    // create a new curl resource
    $ch = curl_init();

    // set URL to download
    curl_setopt( $ch, CURLOPT_URL, $url );

    // set referer:
    curl_setopt( $ch, CURLOPT_REFERER, "" );

    // user agent:
    curl_setopt( $ch, CURLOPT_USERAGENT, "TifsSoftCharsetConverterScript/1.0" );

    // remove header? 0 = yes, 1 = no
    curl_setopt( $ch, CURLOPT_HEADER, 0 );

    // should curl return or print the data? true = return, false = print
    curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );

    // timeout in seconds
    curl_setopt( $ch, CURLOPT_TIMEOUT, 10 );

    // download the given URL, and return output
    $output = curl_exec( $ch );

    // close the curl resource, and free system resources
    curl_close( $ch );

    return $output;
}

$resp = DownloadUrl( 'http://freedb2.org/~cddb/cddb.cgi' .'?'. $_SERVER['QUERY_STRING'] );

$resp = iconv( 'UTF-8', 'WINDOWS-1252', $resp );
$resp = iconv( 'WINDOWS-1251', 'UTF-8', $resp );

header( 'Content-type: text/plain; charset=utf-8' );
echo $resp;

?>