Reputation: 15
I'm having a hard time getting the solution for this. I'm intending to tag many users using php sdk. The sdk returns "Fatal error: Uncaught OAuthException: (#100) Invalid keys "tags" were found in param "tags"..
In my controller I have this:
$tags = array();
foreach($to as $id){
$tag = array();
$tag['tag_uid'] = $id;
$tag['x'] = rand() % 100;
$tag['y'] = rand() % 100;
$tags[] = $tag;
}
$argsTag = array(
'tags'=> $tags
);
$photo_details['message'] = $message;
$photo_details['image'] = '@' . realpath($file_path);
$photo_details['tags'] = array($argsTag);
$upload_photo = $this->fb_obj->api("/me/photos", 'post', $photo_details);
Tried using $tag as well as $tags variable.
Using $tags, I got an error of Invalid keys "0,1,2" were found in param "tags".
Using $tag, I only tagged 1 user instead of three.
Upvotes: 1
Views: 557
Reputation: 1289
try this
foreach($to as $key => $id){
$tag = array();
$tag['tag_uid'] = $id;
$tag['x'] = rand() % 100;
$tag['y'] = rand() % 100;
$tags[$key] = $tag;
}
i dont think there be need to this part array($argsTag);
and this
$argsTag = array(
'tags'=> $tags
);
because you defined it as array before
Upvotes: 1