Could not open remote mp3 url

The place for "I can't figure out how to..." questions.
Post Reply
Posts: 1
Joined: Mon Nov 27, 2017 6:29 am
Are you a spambot?: no

Could not open remote mp3 url

Post by openbayou » Mon Nov 27, 2017 7:00 am

I'm having problems reading a remote mp3 url. This is my code:

Code: Select all

<?php // Copy remote file locally to scan with getID3()
$remotefilename = '';
if ($fp_remote = fopen($remotefilename, 'rb')) {
    $localtempfilename = tempnam('/tmp', 'getID3');
    if ($fp_local = fopen($localtempfilename, 'wb')) {
        while ($buffer = fread($fp_remote, 8192)) {
            fwrite($fp_local, $buffer);

		// Initialize getID3 engine
		$getID3 = new getID3;

		$ThisFileInfo = $getID3->analyze($filename);

        // Delete temporary file
This is my result

Code: Select all

    [GETID3_VERSION] => 1.9.15-201711201016
    [error] => Array
            [0] => Could not open "" (!is_readable; !is_file; !file_exists)

This happens with all mp3 links.

James Heinrich
getID3() v1 developer
Posts: 1477
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada

Re: Could not open remote mp3 url

Post by James Heinrich » Mon Nov 27, 2017 1:15 pm

You're trying to analyze $filename but you don't set it anywhere (you set $remotefilename and $localtempfilename, but not $filename).
If you change $getID3->analyze($filename); to $getID3->analyze($localtempfilename); it should work.

Post Reply