gesseg Posted June 17, 2010 Share Posted June 17, 2010 Hi Im getting a weird error for this simple bit of code. Error is:"Resource id #6" code is here: http://pastebin.com/T4P44d6h Quote Link to comment https://forums.phpfreaks.com/topic/205014-resource-id-6-weird-error-for-simple-code/ Share on other sites More sharing options...
trq Posted June 17, 2010 Share Posted June 17, 2010 $band is a file handle resource, you need to pass it to fread. Quote Link to comment https://forums.phpfreaks.com/topic/205014-resource-id-6-weird-error-for-simple-code/#findComment-1073258 Share on other sites More sharing options...
Alex Posted June 17, 2010 Share Posted June 17, 2010 That's not an error, it's just not what you expected. fopen returns a resource, not the data you're expecting. For that you'll need to use fread. Or instead you can more simply use file_get_contents: $file = 'http://ws.audioscrobbler.com/1.0/user/sandi-g/topartists.txt'; $data = explode(',', file_get_contents($file)); // ... Quote Link to comment https://forums.phpfreaks.com/topic/205014-resource-id-6-weird-error-for-simple-code/#findComment-1073259 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.