create backend API for Mobile Apps using wordpress - php

i have the latest installation of wordpress.
what i want to do is this:
Suppose i have a site at www.mysite.com and it is running wordpress
now i want to create a page called userAuth.php so the url will be www.mysite.com/myapp/userAuth.php when this page is open the user is presented with a login form.
On successful authentication of the use he is presented with another form userData.php where he has fields such name,sname,no etc where he can enter the details and save them.
Then when on my mobile app i get the data form www.mysite.com/myapp/servData.php i will get the data the user has entered.
i know how to code the above mentioned interface in PHP but i was wondering is there a plugin or some other hack in WordPress that i can use for my api needs?

You can use JSON-API WordPress plugin for creating the web-services that can be used for fetching the data from Wordpress by mobile app.
And the plugin will provide the webservice url something like that :
www.mysite.com/api/servicename
Plugin link : https://wordpress.org/plugins/json-api/
Hope it helps you some extent.

Related

How can i do if some one press read more button it ask for login in wordpress

i am new to wordpress, now only i started learning wordpress, i developed one website in wordpress using a theme.
in my site i have read more button, now my client asking if some one press read more button it ask for login and after login only the rest of the contents visible to the users.
i dont know how to do it in wordpress.
is theire any plugins available for this or how to develop a code for this
please help me .
Thanks in Advance
Depends on what kind of login you would need. In the publish settings of a post or page (the box with the publish button in it), you can change the visibility to private, then choose a password one needs to enter to view the contents. All one needs to view the content is this single password, no need for a wordpress user.
Alternatively, if you require your visitors to have a wordpress user to be able to login and view the content, you could use this plugin: https://wordpress.org/plugins/pagerestrict/

Display a view in the mobile app, from the website (knowing if user comes from application)

Let's see if I can explain this and make sense at the same time...
I've a website and a mobile app for that website. In some cases I'll use the view on the website in the app. I wont redirect the user to the website, but the website view will display in the application. But in this view I'll also make some changes. Lika media queries but at the same time not, because it the user is using a mobile but not the app, a the website will show as normal, but responsive of course.
UPDATE (trying to explain a bit better)
If you use the mobile app, only a specific part of the website will be shown. In this case it will be product categories. Header, footer and all the other content will be gone except for the product categories. If you use the mobile and for example safari, the header, footer and all that stuff will be shown.
So the question here is how can I check, with using PHP, if the user is coming from a mobile app and thereafter display a certain view?
You could have the mobile application open up the website with a GET variable set. Example would be the mobile app would open up www.myWebsite.com?source=mobile.
This way when the php is run on the page you can have something like:
if ((isset($_GET['source'])) && ($_GET['source'] == 'mobile'))
{
//This is a mobile view!
}
A downfall to this would be that anyone could just type ?source=mobile to trick the browser into thinking it's coming from the app.
If you use third party mobile application you can try figure out the source of the request by HTTP User-Agent. Usually issues about views solving by CSS with #media rules.
I hope I got your problem.
You can check by user agents. Using _SERVER['HTTP_USER_AGENT'];
Or else you can use 3rd party libraries like
http://mobiledetect.net or you can use bootstrap library for do that.
If you want to do different design for mobile and desktop then I prefer to you to use bootstrap library.

Is there any Custom facebook script for personal website?

I am working on website like facebook. In which i need to post video, images and post status and there is like,comment option for all posts same like facebook. So my question is there any custom script opensource so i can implement into my website.I did some googling but doesn't get any script like that.If any one knows about this script then please let me know.
Wordpress + Buddypress plugin could be a solution.
Obviously, nothing is going to have the exact Facebook functionality off the shelf.
You can use jomsocial for create this type of site. but no one script find which bind your all requirement about create this type of website

Contact form in a facebook page/tab

I need to create a contact form in a Facebook tab, that is supposed to store every entry/submission in a MySQL database. But i'm quite stuck.
Doing the HTML part, creating the form and the inputs wasn't that hard, but the main problem comes from the iFrame/HTML applications from Facebook (i used some already - popular - made apps that i found around).
I cannot include PHP into the Facebook tab, because it's only has support for html/css/js. I tried using but failed, as they are not displaying their source inside the Facebook tabs, so how am i supposed to accomplish this task?
LE: I managed to self-sign a certificate. Now the application is starting, as i provided secured URLs, but instead of loading the index.php in that directory i pointed, it gives me a 404 of the main site.
The main site is quart.ro, the url/secured urls are: http://quart.ro/beautydistrict and https://quart.ro/beautydistrict.
Should i write an .htaccess only for that folder? Or should i change the urls to point directly to the file ex: http/s://quart.ro/beautydistrict/index.php/?
LE2: On the application's page - https://apps.facebook.com/beautydistrict/ - it displays the content correctly (this content - http://quart.ro/beautydistrict). This app is a page tab. If i install the app to a facebook page, then instead of displaying the content correctly it gives the 404 of the main website (intead of http://quart.ro/beautydistrict i get http://www.quart.ro/404).
You can post your html data into external PHP file using jquery and ajax. Use this guide http://api.jquery.com/jQuery.post/

Manage Facebook Page - Add sections Tabs

We want to manage a facebook page using php/mysql and php-facebook-sdk, we have a site with the sections below: About Us , Services, Projects, Contact Us.Each section contains data. We want to add programmatically a tabs sections called About Us , Services, Projects, Contact Us in the Facebook page related included a links to the site. We understand the creation of application on Facebook first, but the question is how proceed to use the facebook php-sdk or api's(graph api) related to do that? or any tutorials exist for this reason?how proceed to add new tabs with titles, and add data using php/mysql with this data?
We want to do exactly like the tabs in the page below:
https://www.facebook.com/doreuk
(About Dore, Contact us,....)
Thank you for your suggestions...
A facebook tab is a page on your (own) server framed in by facebook. So create a html page, make it available under http and https. Next follow the instruction in this tutorial:
https://developers.facebook.com/docs/appsonfacebook/pagetabs/
create your page
create a new app developers.facebook.com
choose page tab
install your app by visting: https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&next=YOUR_URL
You don't need to use the facebook php-sdk or api's(graph api) to do this!

Categories