[ "method" => "GET", "header" => "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36\r\n" ] ]; $context = stream_context_create($options); $html = @file_get_contents($url, false, $context); if ($html === FALSE) { die("Could not retrieve the page content."); } // 2. Extract the content URL from the tag // We look for: if (preg_match('/property="og:video"\s+content="([^"]+)"/', $html, $matches)) { $embedded_url = $matches[1]; // 3. Parse the Track ID from that URL // The URL looks like: https://bandcamp.com/EmbeddedPlayer/v=2/track=3118106658/... preg_match('/track=(\d+)/', $embedded_url, $track_matches); $track_id = $track_matches[1] ?? null; // Try to find Album ID if it exists in the string (it might not be in the og:video tag for singles) preg_match('/album=(\d+)/', $embedded_url, $album_matches); $album_id = $album_matches[1] ?? null; // Get the page title for the link text preg_match('/