hello so I have 2 wp installations with buddypress, I would like to pull the second site members remotely and display them on the first blog.
is there a way to use WP_User_Query with a different database ?
In most server configurations, external access to the database is not allowed, in order to increase security. Thus, direct access to the database is probably not an option.
But Wordpress has a API that is made for external access via HTTP. The API has a getUsers function that should help you.
There are several libraries that can help you make XML-RPC (the protocol of the Wordpress API) requests, see Which PHP RPC (XML or JSON) library have you successfully used? for an overview.
Related
I have a nextjs application which uses the built in api, the front end website is fetching data from the api using vercel's SWR hook. There is no authentication on the website, and no plans to use any in the short term. How can I limit data fetching to the website only and protect the API from being accessed by other clients e.g. curl, postman?
I am using cors to whitelist the website domain, but this only limits access via the browser. At some point I plan to give access to the API to other specific third parties, therefore an API key would be an obvious approach, but if I use this on the front end data fetch, it will be visible to anyone using the website? Any ideas please what approach I can use? Thanks!
I'm wondering if it's possible to use the Wordpress RESTful API to push and pull data and information from/to other websites.
For example, could I make my own application/website, like a CMS, that would utilize the WP API to change content, images, etc on other websites? And if so, what would the basic process of setting that up look like?
New to this, so sorry for not being more specific!
The Answer is "Yes, Its possible"
The WordPress REST API provides API endpoints for WordPress data types that allow developers to interact with sites remotely by sending and receiving JSON objects. When you send content to or make a request to the API, the response will be returned in JSON. This enables developers to create, read and update WordPress content from client-side JavaScript or from external applications, even those written in languages beyond PHP.
Please check wordpress codex for more information.
I 'm developing a WordPress plugin related to a platform i created earlier. The plugin will be needing some data from the database of that platform.
What is the best way to let the plugin to communicate with my external database without risking the security of my platform?
Write some api routes for your platform,like:
https://myPlatform/api/posts
In your wordpress plugin, request the apis of your platform.
You could use these requests packages:
https://github.com/guzzle/guzzle
You should alse do some validation while requesting your platform.
The accepted answer is good, but i would like to add a few things.
1) Always use secure channels for communication if the information is more likely to contain critical information (https).
2) Make good use of permission based Queries on the platform side and maybe on the plugin wordpress side check for the current logged in roles (if needed), if a particular role doesn't have to access a specific endpoint don't allow him both ways earlier checks can avoid unnecessary requests.
3) Try to make those request to the platform in a non-blocking way (ajax), to prevent unnecessary page load times.
4) Anticipate as much scenarios of how the platform will communicate its multiple messages and how your plugin should interpret them.
I have a WordPress website with custom tables that I store data into that was entered by customers. The site owner wants to develop a barcode app that can access this data. When I need the data from these fields to display within the site, I request it from a PHP script running on the server that make calls like get_post_meta().
The owner has hired a mobile app consultant who believes that, if he just has the password to the account where the site is hosted, he can access all of these database fields from the app.
I'm not seeing how this is possible. My understanding is that a mobile app can only access a site by making HTTP requests to it. It has no way of running on the server and executing things like get_post_meta().
Am I missing something?
Thanks
I think you are missing something. Wordpress now has a rest api https://developer.wordpress.org/rest-api/ that can allow a mobile application get at data in your database by making http requests.
The developer will need to be able to enable the Rest Api, but if you give her the password, she will probably be able to do so. Typically this is done using a plugin like: WP Rest API which enables a set of default endpoints which includes post meta data and allows you to add other endpoints
Depending on how the custom tables are set up, they might not be automatically available to the Rest API. However, if you are able to access them using get_post_meta() then I would expect that they would be accessible to the Rest API as well, most likely by adding endpoints.
I want to use Webex API [www.webex.com] to create meeting from my site.
For that I need my own domain in the case of URL API in this way:
"https://yourWebExHostedName.webex.com/yourWebExHostedName/".
And in the case XML API, I need WebexID, SiteID, ParternerID.
Those are mentioned in this Webex official document.
https://developer.cisco.com/documents/4733862/4736679/URL+API+WBS+27+Ref+Guide.pdf
I want to say that these parameters are available in testing environment.
But I don't have my own domain to use this API in production environment.
So I want to know that it is possible to use this API in production environment without owning a domain.
Do you have any Idea? Have you faced such problem? I need urgent solution regarding that.
For the XML API, you can obtain those parameters from this page (you need to login or register first to be able to see the form):
https://developer.cisco.com/site/webex-developer/develop-test/try-webex-apis/
To test the API, all the requests would be made to the sandbox site https://apidemoeu.webex.com
No
You cam't go for production without Webexdomain. Because For recording of video,Host users's and Attendee user's it take space on server to stored all this data you need your web-ex hosting site.