• Resolved Gregg

    (@lorax)


    I have a single site that captures form data (faculty profiles) that I want to pull into other sites using short code. My plan is to write plugin for the form input site that allows configuration of variables for form elements (different colleges, programs, dates, etc.) and puts these into a custom table. Then write another plugin that allows me to set filters (specific college) and then processes shortcodes that allow me to display a list of faculty members based on variable values passed via the shortcode OR displays a single faculty member’s profile.

    All of these sites exist on a single server. Some are WP Multisite installs while others are single installs.

    What would be the preferred method (most secure and best performance wise) for pulling the data from the database of the site that captures the form data into the other sites? JSON or PHP?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Gregg

    (@lorax)

    Reading up on JSON more and came across the documentation that says JSON would be the preferred method.

    Which leads me to questions. If I understand the documentation correct, it seems like I would need to use cURL to query the source site for data using HTTP GET requests. Wouldn’t this create more overhead than a direct query to the database via PHP?

    Moderator bcworkz

    (@bcworkz)

    You don’t have to use cURL, but when getting data from external sites, some sort of HTTP request needs to be sent. cURL is one of a few options. If given a choice in this scenario, JSON does work better than XML or other serial formats.

    But that’s not your scenario. You have multiple sites, but on the same server, presumably they all can access the same DB server containing the WP DB. Then do not use HTTP requests, connect directly to the DB containing the data you need and extract it with a SQL query. There is no question this is far superior to HTTP requests.

    Thread Starter Gregg

    (@lorax)

    Thanks for the clarification bcworkz. I knew if I tried hard enough I could make it more complicated than it needed to be. ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP or JSON to pull data between sites?’ is closed to new replies.