Warning: Invalid argument supplied for foreach()
sobytes opened this issue · 4 comments
Hi
I have upgraded the class but all it gives me know is this error.
Warning: Invalid argument supplied for foreach()
I have the code below
<?php
require $_SERVER['DOCUMENT_ROOT'] . '/libraries/flickr/config.php';
require $_SERVER['DOCUMENT_ROOT'] . '/libraries/flickr/phpFlickrUpdate.php';
$flickr = new phpFlickr(FLICKR_API_KEY, FLICKR_API_SECRET);
$token = $flickr->setToken("32532504353251-187bb235325235b");
print_r($token);
$nsid = $token['user']['nsid'];
//$flickr->enableCache("fs",$_SERVER['DOCUMENT_ROOT'] . '/flickr-cache/', -1);
$groups = $flickr->photosets_getList($nsid);
$title = '';
print_r($groups);
foreach ($groups['photoset'] as $value) {
if($value['id'] == $flickrID){
$title = $value['title'];
}
}
$galleries = $flickr->photosets_getPhotos($flickrID);
?>
Now it just doesnt seem to be returning anything via setToken
Please help website has gone down completely.
The best solution for this error that I've found is to typecast the array:
Change: foreach ($groups['photoset'] as $value) {
To: foreach ((array)$groups['photoset'] as $value) {
Adding the typecast "(array)" will remove the warning.
I am having the same issue. The problem is that nothing is returned. Converting NULL to array does not solve the problem. Did you resolve this?
Can't remember I did fix it tho almost certain it was a server setting for curl that solve my problem I think I have a forked version in my account.
Sent from my iPhone
On 18 Oct 2014, at 06:33, Anna Elman notifications@github.com wrote:
I am having the same issue. The problem is that nothing is returned. Converting NULL to array does not solve the problem. Did you resolve this?
—
Reply to this email directly or view it on GitHub.