This question is a bit wider than accepted on SO, but I need to start somewhere as I am a bit new to some things.
I am developing an iOS/Android app for a client who has an online store based on Wordpress.
Inside the app, the user logs in using their user credentials that he/she has created on the online store, where the underlying login system is handled using webrequests
His WP site has a database called store_locations consisting of longitude and latitude fields, and I need to somehow read the fields from the app.
What I am wondering is:
would I need to create a custom PHP script to access the DB?
How is security handled such as user verification?
Where is the PHP script placed on the server?
NOTE:
Please let's have a discussion in the comments first, as I might need
to fine-tune the question as per request if anything is unclear.
EDIT 1
I found the following video https://www.youtube.com/watch?v=f7ID_L91lIk
where the instructor at 19:00 to 20:51 talks about what I'm assuming would clarify question 2 from above.
If you are going to interact with Wordpress from an external source you should use WordPress REST API.
You need to fetch data from a custom database table, so take a look at Adding custom endpoints.
As you said, this is probably too broad for here. I suggest you create a plugin that gives you ajax access. You can study up on that here and then when you have more specific questions, let us know.
I understand that you asked to discuss it in the comments first, but there is just not enough to discuss here and that is asking quite a lot for an undeveloped plan.
If you have more questions, feel free to comment here.
Related
I'm setting up around 4 Laravel 5.3 based apps at the moment, they are all part of one "ecosystem".
I plan to use a central Laravel app that will handle any user signup, user login and also hold all user details. These details will be used across the 4 separate Laravel web apps. I may also use these user details inside mobile apps in the future so I assume i'll need some sort of JWT based system to control this.
I've thought about using Laravel Passport to achieve this but I don't think this will work for this scenario. In all honesty, the documentation is not clear to me whether this is the sort of system it is designed for or if I need to use a different oAuth2 system. My understanding is it is for API authentication only, or am I wrong?
All my other Laravel apps will be on different servers so I can't share the database unfortunately. I need to implement a cross domain solution it seems.
Thanks in advance for any info on this, just to clarify that I am not asking you to code the script for me, simply to help point me in the right direction on how to do this properly - can't really show code on something I don't know!
I believe I have explained everything that I am trying to achieve here, and I have already done research but nothing seems to be clicking in my brain.
I think it depends on your business logic. Below is what i'm thinking:
If what you mean Multi Domains is the sub domains (as you mentioned login.site.com), i think the simplest way is to use site.com wide cookie with redis/memcached as the session storage solution.
If they do have different domain names, and beyond the central site, user when visit site A also want site B feature (or content, those sites are closely connected), i thought the JWT solution is the better choice.
Any other cases, choose OAuth
Well, maybe others have better ideas.
My web development experience has mostly been setting up a CMS like Wordpress or Drupal and creating custom themes. Actually work in server-size coding has been very minimal. I've played around with php a little, trying to mod off of phpBB and beginning to learn some MVC work with CodeIgniter. Overall, this seems like a pretty big step forward, but it's something I need (I think) to do for a project I am working on.
Essentially what I want to do is have a service like Twitter of Facebook (not in the social networking sense); a user is able to log into the site and perform various operations, while also being able to use an android application that supports limited operations.
After some Googling and reading articles on the internet, it appears REST is the way to go. But I can't quite seem to grasp some of the technical details. I understand how the HTTP Request/Response works, but I don't know how I can code everything server side so that visiting example.com/item/1 will bring up the details of item 1 in the browser and can also perform a GET Request in my Android app so it can grab the details from the database and display in on the site.
Any suggested readings or some tips on how to execute this?
You can implement this using MVC. By default, have the controller ask the model for the details of the item, then pass the info to the view. Repeat this process for each type of request you want to accept such as POST, PUT etc., where you define a new function in the controller, ask the model to perform the corresponding database action, and return the response to the view.
There is helpful tutorial for getting a REST server up and running using CodeIgniter here
This is not truly an API scenario. I know APIs deliver content in XML or JSON. I am not looking for someone to tell me how to do this but to give me a good starting point and some tips or tell me this is a stupid idea.
WHAT I WANT TO DO
Client User needs to be created through another website
Client needs to be authenticated through another website
Client needs to request pages that are HTML.
Client will need to save data to our database from these pages.
We will need to track each created user
We want the person implementing this "api" to their site to be required to have as little programming knowledge as possible.
Your input is greatly appreciated and valued. Thanks!
I think my best solution will be to use an iframe.
Recently I've read a number of articles talking about the idea of using "feature toggles" or "gatekeepers" to keep features hidden from users until the development is done. Facebook and Flickr both also talk about how they use this to test new features with a subset of users before unleashing them on everyone.
A bit of googling didn't turn up any existing PHP packages/tools that can be added to a web app to handle this type of thing. It seems straight forward enough to roll our own but no reason to re-invent that wheel if we don't need to. Are there any existing PHP tools to do this?
Articles
Feature Toggle by Martin Fowler
Flipping Out on Flickr DevBlog
Clarification: The part of this that I'm looking to see if it exists is the admin panel that controls which users can see the new features. In Flickr's example, they can turn it on based on the host. In the Facebook example, they add functionality such as limiting a feature to 5% of users, only TechCrunch users or only East coast users.
The admin panel seems crucial when you have 200 turned on features, 10 features that aren't quite done yet and 3 more that you're demoing for some users.
if (user_can_see_app()) {
show_app();
} else {
dont_show_app();
}
I fail to see why a package would be required for something so simple.
I've wrote a micro service for feature toggle pattern, called Bipolar:
https://marinho.github.io/bipolar-server
It is written in Python but that doesn't matter because it is an external API and Admin interface, so, all you need is to write a PHP client for it. We have used it in production for a while but only worked on public release and documentation recently. For JavaScript support it can push notifications using Webhooks as a basic URL call or via Pusher event.
I am bit missed after many years with no contact with PHP, but I can help you to write the client if you are interested.
I hope that can be helpful.
The easiest solution i found is to have the feature toggle state stored in some remote location that can change easily (turn it on/off)
I found it easy to have on GitHub a repo holding some JSON data with the feature toggle's state, later on you can change that state on GitHub (from phone/pc etc...)
your php code needs to fetch the JSON and make a decision from it ...
you can look at the blog post about how to achieve this:
http://www.nimrodstech.com/dead-simple-feature-toggle/
it shows a code snippet of how to achieve this in a simple way.
I'm working with PHP and need to add a survey component. I would prefer something that allows me to embed the survey on the site. The creation of the survey itself can be off-site, no problem there, as long as the users themselves don't have to go elsewhere to answer the survey. Does something like this already exist?
There's another issue: some of the surveys may be closed surveys i.e. sent to a specific group of emails and only those can answer it. So I'm guessing the user will have to click a link which has his email and code coded as parameters. Any other ways to do the same thing that I may be missing?
I'm open to all suggestions... but would really prefer not to have to install an entire open source system for this, unless all else fails.
Wufoo and SurveyMonkey are both really good for this, especially given your requirements. I'd advise you rethink using PHP, per se, and consider embedding one of these in your site (you can control the HTML/CSS so it looks the same). Otherwise, there are quite a few options for you to evaluate... see these lists.
There exist many survey extensions. Maybe you'd like to use survey extension by Joomplace. Now I'm developing an e-commerce website so I think to buy this one. Here is their site: http://www.joomplace.com. I know that this survey supports front-end authoring and it's also possible to create different kinds of reports. Also you can define the list of users you want to address the survey to. But this is for Joomla based sites.