Title: PHP or JSON to pull data between sites?
Last modified: August 22, 2016

---

# PHP or JSON to pull data between sites?

 *  Resolved [Gregg](https://wordpress.org/support/users/lorax/)
 * (@lorax)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/php-or-json-to-pull-data-between-sites/)
 * 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](https://wordpress.org/support/users/lorax/)
 * (@lorax)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/php-or-json-to-pull-data-between-sites/#post-5419462)
 * 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](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/php-or-json-to-pull-data-between-sites/#post-5419555)
 * 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](https://wordpress.org/support/users/lorax/)
 * (@lorax)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/php-or-json-to-pull-data-between-sites/#post-5419581)
 * 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.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 3 replies
 * 2 participants
 * Last reply from: [Gregg](https://wordpress.org/support/users/lorax/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/php-or-json-to-pull-data-between-sites/#post-5419581)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
