Storing Feed from Facebook Group using PHP SDK [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a project that needs me to store a group feed of one of my Facebook groups that I want to store locally (MySQL). I have used PHPs Facebook SDK to successfully retrieve and store the first 24 posts. The rest are paginated like, as seen in the response:
"paging": {
"previous": "https://graph.facebook.com/v2.1/197349856967661/feed?limit=25&since=1413803847&__paging_token=enc_Aezfg88j7xOEW28BENBXvchQql9OYz00t6siBT2MviwZdOCcIFV8nyMyBmrUu39eOHbve68h6yUWLb0Lc12v_HD7k4_q299PnvIq7gz4BAZMZA",
"next": "https://graph.facebook.com/v2.1/197349856967661/feed?limit=25&until=1413803553&__paging_token=enc_AeyKAdBaClRXLJ7nBulYeqDEfzW1ovuAXSuDkPMSnbmIxpPXKh24vli0tOpF_OOtnFCXZLNTZki3j2umR8WKKyo3nLmZtICF1zfq7ZASIk2PdQ"
}
I wanted to know if there was a way in which I can loop the same piece of code until all the entries have been stored in my database. I am thinking is there a way to detect if there is a next page and execute another request using the "next" URL? Please do help me. I will highly appreciate it.

Disclaimer: I am going to give you the procedure not the code, you can code it based on what you need.
login.
make the first request. //don't handle just yet.
if (![paging][next]) escapeLoop =1;
do //using do .. while
if (escapeLoop ==1) break; //exits loop if all posts are received in one page
handle the request //insert to DB
make the new request using the link provided in the response.
while ([paging][next]);
handle the last request & requests with one page response.

Related

Scraping data which loaded after scrolling to bottom [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm working with PHP and I want to scrape some data from any website. But I have a problem. I scrape data but these items number are 48. But I know that page has 11K items. Rest of datas extend when you scroll and you get new bunch of datas (48 items).
I'm scraping with simple_html_dom. How can I manipulate scroll and get data ?
Thanks! :)
Sounds like the missing data is loaded via ajax.
Check the Network tab in the Developer Console (by pressing F12). Take a look at the URL which is being called (and the response), and edit it to your needs. Then call this URL instead of the one you are taking now.
It is impossible by this way.
But if you need to scrap this data you can send requests to endpoints which return lazily loaded data. You must research js code of target site.
p.s.
If you want to use really hard approach, you can research browser emulating.

How to receive notification in android if a data is inserted in the database [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a mySQL database, and I created a simple android app that can display the data from the database using json. And I want to add the function wherein if a data is inserted in my database, the android app will be notified.
For example.I have two android app(App "A" and "B"). App "A" can Insert Data, and "B" can Display the data. I'm thinking of, everytime that App "A" Inserts a data, App "B" will be notified, and can refresh the current displayed data. I am thinking of refresh the list every certain time(5-10sec), but it seems to add more process time, and I think maybe refreshing it only when a data is inserted in the database would be better. Is there a way to do this? Hope that you can provide me some knowledge on how to do this. And if possible some example codes. Thank you.
So if your backend is built using php, this is possible. I assumed that because you've set PHP as a tag.
Every time someone request to insert data to your php, you can insert it into MySQL and if insert went OK you could Google Cloud Messaging (GCM): https://developers.google.com/cloud-messaging/
Read documentation well, because GCM is not one-liner. It requires setup on Google console, your PHP server and Android app.

I want to create a website for polls/survey like this http://www.poll-maker.com/ [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
but did not understand
The concept of generating a link &
more importantly how they save the data in database,do they save it like id of poll & yes/no click or done with other logic.
what will happen to the polls which are expired? will they remain in database or somewhere else?
please help
To handle URL you can use cURL.
But I have an easy method. You can use the concept of Query Strings.
To Create New Question
Store the new question in database.Give Each Question a unique ID.
Then After user submits the questions show him a link like:
http://do-survey.com?question=xzxsa
To store polls
Get question like:
if(isset($_GET['question']))
{
$question = $_GET['question'];
// Now you have the question unique id manipulate the database using this
}
this is not the place to ask such questions, but to make my answer at least remotely useful:
they're not generating a link. That link doesn't exist under the form of a file on the server. Take for example a database containing 'id' 'poll' 'var1' 'var2'.
You can make a php page that gets a param from the link, have it like mysite.com/poll?id=1
The php script will get the '1' as a param, then you SELECT * FROM table WHERE id=1 and you generate the contents via php with the data from the DB.

How to create php pagination without page numbers [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I need to create pagination and it should not have page numbers as if I have it then I need to load all data at page loading.(I was ordered to do so)
I am little bit lost. Don't know where to start Even a little help is highly appreciated.
using zend framework 2(MVC)
new to php and zend
Prefer not to use library
I am assuming, What you mean is that you cannot have page numbers listed with the results on your page, but just a forward and a back button. You keep track of what offset/limit results are being currently viewed by user, and depending on if the user clicks back/forward, you will send an appropriate request to server with offset and limit as parameters. The server based on php/Zend should return results based on this offset and limit.
I have had a precursory look at Zend Pagination and it seems to me that it should work for you.

Instagram Real-time PHP API [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
got some questions about the Instagram real-time api. first let me tell you what I want to do. I'd like to run a daemon process with a socket connection or something of the like to the Instagram API to get a constant feed of photos with a certain tag. We estimate it to be a large amount of data at a particular time (thus why we want to go Real-time). This process will parse the feed and store it into a mongodb.
Secondly, for the front end, I'd like to display all new, live photos in real-time, possible with ajax or some form of checking on a set interval.
Problem being, I can't find anyone doing this with php. All of the resources I have seen use Node.js and Tornado. Has anyone done this with PHP or know of a good Real-time API demonstration/tutorial to get me started?
Here's the documentation...
http://instagr.am/developer/realtime/

Categories