I am attempting to fetch all posts and respective comments of a user within a certain time frame and I am having trouble finding the fields for the FB SDK. I see the "until" option but I do not see a usage/explanation of it.
me/posts?fields=object_id,shares,source,story,to,link&limit=10
I want to add a field that only collects posts between two dates. I will then get rid of the limit field. Any suggestions/resources will be great!
Thanks!
The information can be found here: https://developers.facebook.com/docs/graph-api/using-graph-api
A time-paginated edge supports the following parameters:
Until : A Unix timestamp or strtotime data value that points to the end of the range of time-based data
Since : A Unix timestamp or strtotime data value that points to the start of the range of time-based data.
Related
I have an Android App linked to an SQL database,
Now when the user posts a comment from the app, I want to get his real time and date (based on user's timezone).
I've already tried functions like date() and time() but these functions get the remote server time not the user's time.
Is there an api or similar, that I can use to do that - such as get time from IP address ?
I work on a PHP project where users place advertising posts. When advertising post is placed online it is given a "hide date" (stored in database), when it will no longer be shown to the users. When "hide date" (e.g. next Monday at 10:00am) occurres I need to fire a script that makes changes in the database (not related to hiding the ad).
Question:
How do I run a script at the exact time in future(at "hide date").
I google'd a lot and didn't find any good solution.
Found possible solutions:
Cron isn't considered any more because of its lack of accuracy (for my task even seconds matter).
Write a daemon which will check every second if there is a record with a "hide date" but it can be very consuming.
Another way as I was told that message queues could be of help, but after reading some of the documentation I didn't find a way of setting date and time of processing the message in queue.
Can anyone point out where to look? Any tool/language is considered.
Let's suppose that ads show until a week after
Create a field in your ads table called expiry_date (timestamp)
When a new ad is inserted, do the following
$expiry_date = strtotime("+ 7 days");
Then insert the expiry date along with the record
Next, in the page that displays the ads, select only ads whose expiry date did not pass yet, so
SELECT * FROM ads WHERE expiry_date >= NOW()
This will only show ads that didn't expire yet.
If your site is running on a linux server, you can add a cron job to trigger your update script.
If your site is running Windows, use Task Scheduler instead.
However, it doesn't really sound like your best solution. You could store the "hide date" in the database along with the rest of the post's data. Then you can simply filter the posts in your display code.
i need some help to plan an effective algorithm to check who is online to my web site, with PHP and AJAX.
(i dont need you to write any sourse to me!!)
the biggest problem is how to know when the member get off.
in the end, it will be a list of online members that alwayes update, like what facebook have.
You can use a timestamp, with PHP you can do strtotime("now");
You add that timestamp to the user's table in MySQL, or their session info. Then, you update that timestamp whenever the user changes pages or accesses the site. To determine if the user is offline, you can remove the timestamp when the user logs off, and if the user just exits without logging off, you would just compare the timestamp to the current time.
For example, you could look to see if 15 minutes has passed by checking the timestamp variable like this:
if($timestamp <= strtotime("-15 minutes")) echo "User is offline";
I am working on rss parser project, I need to fetch URL from us based server and store the data in to database while storing/viewing I need to keep the post time.
I am using simplepie for rss aggregation, I face the following problem while handling rss
while I am checking rss url in firefox 3.0.19/system timezone set to Chennai/Kolkatta/Mumbai(UTC+5:30)now firefox displays post time for the post is 10:51 am
at the same time if i check the same url in another system which has firefox 3.6.1/system timezone set to Chennai/Kolkatta/Mumbai(UTC+5:30) now firefox displays post time for the post is 11:34 am
how do I know which time is correct?
and how do I get timezone for the RSS Server for php
RSS Feeds stored in one server and I installed PHP application in another server both of them located in us.
Which timezone should I use?
i set following time zone in my code
<?php
date_default_timezone_set('US/Central');
?>
but post time is wrong when display
i solved the problem my self using below method
get list of all timezones take first post's post date and set the first timezone format the date and set the second timezone format the date and so on.. finally i compared formatted date with postdate then i got the timezone of the server
i am implementing a forum in php. I Would like to add a feature in which user can add a post by setting some future date so that on that date in future the post will be displayed. Could anyone give me an idea how to implement that(logic).
Submit the post to the database with a future time and, when you query it to find the posts, limit the results to those whose time is less or equal than the current time.
If you still want to distinguish time of publication from time of submission, you can have one column for each and display the post based on the time of publication.