Answers.Body: <p>The best way to do that is to make use of the CiviCRM REST API.</p>
  
  <p>It can be used via PHP or via JavaScript.</p>
  
  <p>With that method you collect the data you need, and then you can display it as you like.</p>
  
  <p>Much more information can be found:
  <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/REST+interface">https://wiki.civicrm.org/confluence/display/CRMDOC/REST+interface</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-12T09:42:17.767Z
Answers.Text: I recommend not using the REST api from javascript in the browser (from a node.js is fine, the language isnt' the issue), it's a security issue to leave the api_key and keys visible to everyone.
Answers.UserDisplayName: Xavier
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-12T08:57:34.053Z
Answers.LastActivityDate: 2016-02-12T08:57:34.053Z
Answers.UserDisplayName: Catorghans
Answers.Body: <p>We are just working on a situation where a customer wants to send data from a Wordpress form on the website to CiviCRM on another site, check <a href="https://civicrm.org/blogs/erikhommel/passing-form-data-from-wordpress-to-civicrm" rel="nofollow">https://civicrm.org/blogs/erikhommel/passing-form-data-from-wordpress-to-civicrm</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-12T09:36:10.020Z
Answers.LastActivityDate: 2016-02-12T09:36:10.020Z
Answers.UserDisplayName: ErikH - CiviCooP
Answers.Body: <p>Using the REST API is probably a good venture when  your instance wants to communicate with other servers and systems.</p>
  
  <p>Very important things are to be taken into consideration</p>
  
  <p>1) you have tried to use the API explorer on your civi instance on WP to fetch and display contacts in JSON, from which a request URL will be provide for performing the same operation through REST</p>
  
  <p>2) The site key is replaced in the REST URL with the site key in the civicrm.settings.php probably in ".../wp-content/plugins/civicrm"</p>
  
  <p>3) The security verification process is validated. This is done by ensuring that the current user who sends the request has an api_key to authenticate the request. you could verify this by searching the contact on your civi instance, getting the id, and then querrying you database with " select api_key from civicrm_contact where id='user_id;'</p>
  
  <p>If the api_key is not there update the record with " update civicrm_contact set api_key='chosen_key' where id='user_id "</p>
  
  <p>with all of this you should specify how you want the server to return the data probably in JSON ( by adding argument in URL &amp;json=1 )</p>
  
  <p>Finally you should have a URL that looks like this 
   <a href="http://your-server/wordpress/wp-content/plugins/civicrm/civicrm/extern/rest.php?entity=Contact&amp;action=get&amp;id=203&amp;api_key=XXXXXXXXX&amp;key=" rel="nofollow">http://your-server/wordpress/wp-content/plugins/civicrm/civicrm/extern/rest.php?entity=Contact&amp;action=get&amp;id=203&amp;api_key=XXXXXXXXX&amp;key=</a>"XXXXXXXXXXXXXXXXXXXXXXXX"&amp;json=1</p>
  
  <p>The returned data should be useful you can now manipulate and display on the other server page.</p>
  
  <p>You can find more at <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API" rel="nofollow">CiviCRM REST API</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-16T11:42:51.393Z
Answers.LastActivityDate: 2016-04-16T11:42:51.393Z
Answers.UserDisplayName: Merci Mukwe
Body: <p>I have a civi instance installed on WP and would like to access and display a contact's data on a different (non WP) site.</p>
  
  <p>Tried to embed the whole civi page and pass the contact ID using this url format but since cross origin framing is not allowed it didn't work:</p>
  
  <pre><code>http://myserver/wordpress/wp-admin/admin.php?page=CiviCRM&amp;q=civicrm%2Fcontact%2Fview&amp;cid=**XXX**
  </code></pre>
  
  <p>How can I fetch and display a contact's details on an external page?</p>
  
Tags: <wordpress><contact-view>
Title: Accessing CiviCRM contact data from external page
ThreadText: # Accessing CiviCRM contact data from external page
  
  (Asked by: username_0 on 2016-02-12)
  
  I have a civi instance installed on WP and would like to access and display a contact's data on a different (non WP) site.
  Tried to embed the whole civi page and pass the contact ID using this url format but since cross origin framing is not allowed it didn't work:
  http://myserver/wordpress/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fcontact%2Fview&cid=**XXX**
  
  How can I fetch and display a contact's details on an external page?
  
  **Tags:** wordpress, contact-view
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2016-02-12. Score: 5
  
  The best way to do that is to make use of the CiviCRM REST API.
  
  It can be used via PHP or via JavaScript.
  
  With that method you collect the data you need, and then you can display it as you like.
  
  Much more information can be found:
  <https://wiki.civicrm.org/confluence/display/CRMDOC/REST+interface>
  
  > **Comments:**
  > **username_2**: I recommend not using the REST api from javascript in the browser (from a node.js is fine, the language isnt' the issue), it's a security issue to leave the api_key and keys visible to everyone.  
  
  ---
  
  ### Answer by username_3 on 2016-02-12. Score: 3
  
  We are just working on a situation where a customer wants to send data from a Wordpress form on the website to CiviCRM on another site, check <https://civicrm.org/blogs/erikhommel/passing-form-data-from-wordpress-to-civicrm>
  
  
  ---
  
  ### Answer by username_4 on 2016-04-16. Score: 2
  
  Using the REST API is probably a good venture when your instance wants to communicate with other servers and systems.
  
  Very important things are to be taken into consideration
  
  1) you have tried to use the API explorer on your civi instance on WP to fetch and display contacts in JSON, from which a request URL will be provide for performing the same operation through REST
  
  2) The site key is replaced in the REST URL with the site key in the civicrm.settings.php probably in ".../wp-content/plugins/civicrm"
  
  3) The security verification process is validated. This is done by ensuring that the current user who sends the request has an api\_key to authenticate the request. you could verify this by searching the contact on your civi instance, getting the id, and then querrying you database with " select api\_key from civicrm\_contact where id='user\_id;'
  
  If the api\_key is not there update the record with " update civicrm\_contact set api\_key='chosen\_key' where id='user\_id "
  
  with all of this you should specify how you want the server to return the data probably in JSON ( by adding argument in URL &json=1 )
  
  Finally you should have a URL that looks like this
  <http://your-server/wordpress/wp-content/plugins/civicrm/civicrm/extern/rest.php?entity=Contact&action=get&id=203&api_key=XXXXXXXXX&key=>"XXXXXXXXXXXXXXXXXXXXXXXX"&json=1
  
  The returned data should be useful you can now manipulate and display on the other server page.
  
  You can find more at [CiviCRM REST API](https://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API).
  
  
  ---
  
  