I'm working on a WordPress e-commerce project that need to be converted into a mobile App.
I created few custom PHP files besides regular WP files where using PHP codes I'm sending products data by JSON directly from MySQL WP database.
But I'm facing two problems here:
1) If there are more than 20 posts/products in a wp_posts table then JSON page becomes empty but if they are less than 20 then the data are passing properly.
2) I think the process is not secure because the URL which contains JSON data are publicly accessable so anyone who knows the URL of JSON page will get access all secret data like username and password.
Question 1: Is there any other way to send data from MySQL to Android except JSON, also way to restrict access to JSON URL page publicly?
Question 2: Because this is an e-commerce website so there will be more than 20k+ posts/products, so will a single JSON page be able to handle those 20k+ data? 20+ data is turning the page black currently, so how to solve those issues? Thanks a lot.
Imagine I want to store in my database the facebook posts from a user/page for getting them and manipulate them simplier.
I will make a php script that will be launch every day for each user/page who will get the posts I don't already have in my database and insert them.
Now, on my front website, you can log in, and see your posts.
Now, you go on facebook, and modify one of your post.
Now you come again on my website, and obviously, you don't see the modification you did on facebook, because this modification is on facebook database and not in mine, and your posts a retrived from my Database.
Theorically, one of the solution will be that facebook has a "log" table for posts, where i can find something like "this posts has be updated" so i can update my table. Something like that exist ?
If not i have a second solution, at each posts send from my server to my website, update it automatically with facebook database (getById the post on fb an update it in my db) and after that send the posts to my website. But this will be a mess and a lot of request for nothing.
So how can i do this ? Someone have already tried this ? Or only directly manage the posts from facebook database ?
Thanks =)
Facebook has a mechanism to send updates to you, called webhooks.
https://developers.facebook.com/docs/graph-api/webhooks
You can subscribe to several fields for users or pages, among them the feed.
You’ll have to check if it delivers updates to already existing posts as well - but I think it should, would make little sense if it didn’t.
How would one develop a PHP app that would constantly update the current state of a webpage? Is there some sort of a pattern that can be implemented to achieve this? What would be the ajax programming needed to update the state of what a web page shows?
The basic idea is that of the Facebook news feed where the page is constantly changing as new data gets entered or data is modified.
Why don't you just make API call.
or
Have a look at their documentation: https://developers.facebook.com/docs/php/gettingstarted/
As i have small requirement regarding tracking information from different parts of a flash file using php mysql. Means in a flash game i will be having preloader part, more games button and logo inside the game. As i want to track that how many clicks are getting from these places using php mysql. Can anyone give me any ideas.
Use the URLRequest/URLLoader classes of ActionScript to send a request to your website. Parse the request with PHP, extract the GET or POST variables and insert them into your database.
We built a survey tool on top of google forms using wordpress.
Simply, you create a google form, create a private open link, put into a wordpress backend page, then the system processes the module server side and generates the necessary html file. When the user fills the form and sent it, via ajax the server use zend gdata to write the results on the spreadsheet connected to the form et voilat.
But this system is limited, also because google form is quite limited. We want to improve it.
That's why I'm asking your opinions to upgrade the system to have some more features:
We want to be able to keep the form open so that users can fill it in more than one occasion. theoretically then, we need to know which user the spreadsheet rows are connected to. This could be done by saving some sort of ID key to recognize the user, but then we don't know how to refill the fields in the form, since the spreadsheet created from the forms don't retain any sort of key to connect columns and form field.
We need more field types! like a file upload field that put the uploaded file in a specific gdrive folder.
We need to see the data for the single entry while google gives you only the whole spreadsheet that's quite hard to read.
It's not an easy task! Which solutions should we use to solve these problems?
Many thanks!
UPGRADE:
We decided to go by using a mix of google forms, google fusion tables, google charts via api access. Here's the simplified algorithm:
The admin user create his form via google forms and save the url. To have more field type, user can put a tag in the field comment, eg [file] for, well, files upload.
The url is put into an admin page of our system. The page fetch the content of the form page and extrapolate into an array, for every field, the title, the ID, the type and the comment; if there's some tag in the comment, this become the field type.
Using this data, system create if not existing a folder with a fusion table inside. if file fields are present, another subfolder is generated. Addresses of these folders and files is saved.
Using the array data, in the fusion table a column is created for each of the array fields, with a column title of this sort "[field_ID field_type]field_title", plus a column for the end user ID.
The admin user, can more over open or close the form.
When a user goes to the form page, the array is used to generate the form. If the system doesn't have in memory the user ID it means that the user has never filled up the form. Otherwise the system will use the user ID to fetch the data from the fusion table to populate the form.
When the user fills up the form, the entries are feed to the columns using the field ID as reference, plus the user ID. The user ID is also stored in the system the remember that the user already filled the form, as said in point 5. If files are uploaded, they are stored in a gdrive folder.
The admin user therefore can go to the admin page and see how many people has filled up the form, can ask for single user data, for summary data using google charts, can download a pdf of data from single user, every user, or summary.
Of course this is the idea, we have to build it. One first question is whether we should use javascript or php to communicate with google, so doing the processing on the client or server side...
If you're asking about Javascript vs PHP, you should know that the Javascript API can't write to a Google Spreadsheet because of Cross-Domain Security issues.
PHP can as it is a server side language. Zend Framework makes it easy to interact with Google Spreadsheets. http://framework.zend.com/manual/1.12/en/zend.gdata.spreadsheets.html
So go with PHP if that was your question.