I'm trying to use the photos_getRecent function which, in the source file, is described as:
function photos_getRecent ($jump_to = NULL, $extras = NULL, $per_page = NULL, $page = NULL)
I'm trying to filter the results based on the owner, which (according to the documentation http://www.flickr.com/services/api/flickr.photos.getRecent.htm) is stored in the extras variable:
"A comma-delimited list of extra information to fetch for each returned record. Currently supported fields are: description, license, date_upload, date_taken, owner_name, icon_server, original_format, last_update, geo, tags, machine_tags, o_dims, views, media, path_alias, url_sq, url_t, url_s, url_q, url_m, url_n, url_z, url_c, url_l, url_o"
So I've tried setting the extras variable to a whole lot of stuff:
photos_getRecent(NULL,"owner_name=john citizen",20,NULL);
photos_getRecent(NULL,"owner_name=john_citizen",20,NULL);
photos_getRecent(NULL,"owner_name:john citizen",20,NULL);
photos_getRecent(NULL,"owner_name:john_citizen",20,NULL);
photos_getRecent(NULL,"owner_name,john citizen",20,NULL);
photos_getRecent(NULL,"owner_name,john_citizen",20,NULL);
photos_getRecent(NULL,"owner_name=10000000#N00",20,NULL);
photos_getRecent(NULL,"owner_name:10000000#N00",20,NULL);
photos_getRecent(NULL,"owner_name,10000000#N00",20,NULL);
but none of them seem to do the trick. Every time it just gets a bunch of random photos with random owners.
Unfortunately the documentation isn't specific at all, and I can't find any examples online using this stuff.
How can I properly format the variable $extras to have it get me the photos only for that owner?
The extras parameter is used in the Flickr search to denote extra fields that you want returned by the API, not fields to search by.
To get photos by a specific owner, you'll want to use photos_search function in the phpFlickr library and pass the argument user_id for your photo owner. The default sort order is date-posted-desc which should get what you are after. For example:
photos_search (array('user_id' => '10000000#N00'));
Check out Flickr's API doco for the search function for more details.
Related
I'm trying to retrieve the unpublished videos I have on my DM account, i.e. the videos I've uploaded to DM but are not yet public. I'm using the PHP SDK v1.6.3 and I'm quite a beginner with the Dailymotion API.
I assume (but I'm not 100% sure) that I have to use the private filter as documented here
I've tried
$api->get('/me/videos',array('filters' => array('private')));
which raises a DailymotionApiException exception with the following message
Unrecognized value (private), allowed values are (featured, hd,
official, creative, creative-official, ugc, buzz, buzz-premium, 3d,
live, live-offair, game, all-live, live-upcoming, no-live, premium,
premium-paidvideos, premium-offers, no-premium, history, with-poster,
without-poster, promoted-on-games) at index #0 for `filters' parameter
which is strange because from this doc, 'private' is a valid filter for videos.
I've also tried
$api->get('/me/videos',array('filters' => array('private' => true)));
which apparently has a wrong format as it also raises a DailymotionApiException exception
Invalid type (array required, dict given) for `filters' parameter
Is there something wrong with the way I use filters in the PHP SDK ?
There are 2 mistakes in what you do:
first, "private" is different from "unpublished"
they way you call the filters is not the right one.
1) A private video is only viewable by you on dailymotion as it does not appear on your channel page. You can share it with other users by sharing the private permalink that you can retrieve using the url field.
An unpublished video is only viewable by you and can't be shared. It should be used when you edit the video (description, title, etc) before publishing it.
2) Now, about the way you call the PHP SDK:
private is a filter by itself, you don't need to add the filters parameter. The filters filter is deprecated (see https://developer.dailymotion.com/documentation#video-filters-filter).
Your call has to be using either of: flags=private or: private filter.
With the PHP SDK, you could use:
$result = $api->get('/me/videos',array('flags' => array('private')));
I am try to fetch the all list of members subscribe to given list for given Group from MailChip API.
I have two list in MailChimp.
1) Master List
Groups: Group1, Group2
2) Test List
All user will be subscribe to each Group1, Group2 for List "Master List"
Now I want to fetch all the members of "Master List" Who has subscribe for "Group1" ONLY.
So, Which API Method I can use to fetch all?
My Code:
$result = $mailChimp->listMembers( $listid, $status );
This will give me all the data from given list but I want to get specific Groups data any idea how can i get?
API Detail: listMembers – v1.3
listMembers(string apikey, string id, string status, string since, int start, int limit, string sort_dir)
Get all of the list members for a list that are of a particular status. Are you trying to get a dump including lots of merge data or specific members of a list?
this might solve your problem. If your API wrapper does not contain this function, add it as follows:
function searchMembers(string query, string id, int offset=0) {
$params = array();
$params["query"] = $query;
$params["id"] = $id;
$params["offset"] = $offset;
return $this->callServer("searchMembers", $params);
}
Not sure this will solve your problem or not, but this will surly get you started...
I need a way to display videos from a specific channel on a page using PHP.
I have authenticated my app and I can use some methods using the advanced API. I am using the official vimeo PHP library to connect.
Below is what I am trying to do and when I dump the array I do not get anything. I can get info back from using get videos from the entire account method.
require_once('/url/vimeo/vimeo.php');
$vimeo = new phpVimeo('number', 'number');
$vimeo->setToken('number','numbers');
$videos = $vimeo->call('vimeo.channels.getVideos', array('ACCOUNT' => 'NAME'));
If I put the channel name where ACCOUNT is I will get an invalid signature error.
Is it worth using something like simple HTML parser for PHP and doing it that or worth sticking with the advanced API?
I would highly advise using the advanced api. If you parse the html, it will break any time vimeo changes their channel pages. Additionally, channels have more than one layout
eg: vimeohq and nicetype
The second parameter of the "call" function should be any querystring parameters the api method requires.
In the case of "vimeo.channels.getVideos" you can provide
channel_id
user_id
page
per_page
summary_response
full_response.
To experiment with the getVideos method, you can use the playground.
So in the end, I believe you want the function to look like this..
$videos = $vimeo->call('vimeo.channels.getVideos', array('channel_id' => 'NAME'));
where NAME is either the channel id, or the channel name (the channel name matches the url slug, so for example "nicetype" not "nice type"
I've recently started developing a portfolio website which I would like to link to my wordpress blog using simplepie. It's been quite a smooth process so far - loading names and descriptions of posts, and linking them to the full post was quite easy. However, I would like the option to render the posts in my own website as well. Getting the full content of a given post is simple, but what I would like to do is provide a list of recent posts which link to a php page on my portfolio website that takes a GET variable of some sort to identify the post, so that I can render the full content there.
That's where I've run into problems - there doesn't seem to be any way to look up a post according to a specific id or name or similar. Is there any way I can pull some unique identifier from a post object on one page, then pass the identifier to another page and look up the specific post there? If that's impossible, is there any way for me to simply pass the entire post object, or temporarily store it somewhere so it can be used by the other page?
Thank you for your time.
I stumbled across your question looking for something else about simplepie. But I do work with an identifier while using simplepie. So this seems to be the answer to your question:
My getFeedPosts-function in PHP looks like this:
public function getFeedPosts($numberPosts = null) {
$feed = new SimplePie(); // default options
$feed->set_feed_url('http://yourname.blogspot.com'); // Set the feed
$feed->enable_cache(true); /* Enable caching */
$feed->set_cache_duration(1800); /* seconds to cache the feed */
$feed->init(); // Run SimplePie.
$feed->handle_content_type();
$allFeeds = array();
$number = $numberPosts>0 ? $numberPosts : 0;
foreach ($feed->get_items(0, $number) as $item) {
$singleFeed = array(
'author'=>$item->get_author(),
'categories'=>$item->get_categories(),
'copyright'=>$item->get_copyright(),
'content'=>$item->get_content(),
'date'=>$item->get_date("d.m.Y H:i"),
'description'=>$item->get_description(),
'id'=>$item->get_id(),
'latitude'=>$item->get_latitude(),
'longitude'=>$item->get_longitude(),
'permalink'=>$item->get_permalink(),
'title'=>$item->get_title()
);
array_push($allFeeds, $singleFeed);
}
$feed = null;
return json_encode($allFeeds);
}
As you can see, I build a associative array and return it as JSON what makes it really easy using jQuery and ajax (in my case) on the client side.
The 'id' is a unique identifier of every post in my blog. So this is the key to identify the same post also in another function/on another page. You just have to iterate the posts and compare this id. As far as I can see, there is no get_item($ID)-function. There is an get_item($key)-function but it is also just taking out a specific post from the list of all posts by the array-position (which is nearly the same way I suggest).
I am trying to tag a friend in FB message to be posted, I am using PHP, and for FB I am using FB Auth API 2.0, I have tried to get related information from facebook developers forum, however can't find enough information for this one.
Can anyone suggest me from where to get started for this? any links to related documentation or forum links using which I can get started?
You use the message_tags field of the Post object. Check out the docs:
message_tags: object containing fields whose names are the indexes to
where objects are mentioned in the message field; each field in turn
is an array containing an object with id, name, offset, and length
fields, where length is the length, within the message field, of the
object mentioned
Something like this:
$facebook->setFileUploadSupport(true);
$tags = array(
‘tag_text’ => ‘ak Yip’,
‘tag_uid’ => 642536423,//it’s my id on facebook as a sample
‘x’ => 10,
‘y’ => 10,
);
$args['tags'] = array($tags);
$args['image'] = ‘#’ . realpath($fn);
$data = $facebook->api(‘/me/photos’, ‘post’, $args);
Note:
**One:Your app need to get permissions like ‘user_photo_video_tags’ and ‘friends_photo_video_tags’.
Two:X,Y is proportion, not coordinate. Don’t put value over 100.**