Skip to content

x[DRAFT] Crawl the Tree

Daniel Marshall edited this page Jul 20, 2015 · 1 revision

Crawl the Family Tree Using the FamilySearch PHP SDK

This document applies to web apps that use PHP to connect to the FamilySearch API. Explanations, suggestions, and code samples are provided for the following objectives:

  • Read ancestors
  • Read descendants

Prerequisites

  • Establish the operating environment described in the FamilySearch PHP SDK Authentication document. You should have the PHP SDK library (gedcomx-php) loaded, a PHP server running, and an access token retrieved.

Crawl the Tree Setup

Copy or download a zip file of the Crawl Tree example files into your FamilySearch PHP SDK test project directory. At this point, make sure you have the following files in your project directory:

familysearch-auth.php
read-ancestors.php
read-descendants.php

Usage

Read an Ancestry

When you read ancestry of a person, you receive the following information:

  • Links to the following information:
    • "ancestry"
    • "artifacts"
    • "change-history"
    • "child-relationships"
    • "children"
    • "collection"
    • "descendancy"
    • "discussion-references"
    • "evidence-references"
    • "matches"
    • "merge"
    • "non-matches"
    • "notes"
    • "parent-relationships"
    • "parents"
    • "person-with-relationships"
    • "person"
    • "portrait"
    • "portraits"
    • "source-descriptions"
    • "source-references"
    • "spouse-relationships"
    • "spouses"
  • Living status
  • Gender
  • Name
  • Conclusion information
  • Source information

The information you read is cached in local memory so that you can potentially increase the performance of your app. See the Caching guide, to consider how caching can increase performance.

Read an ancestry to discover information about progenitors or parents.

####Sample Code—Read Ancestors

In your browser, access the read-ancestors.php file in your PHP SDK project directory (at http://localhost:5000/read-ancestors.php if you are using the embedded server), and examine the information displayed.

Read Descendants

When you read the descendants of a user, you get information about the children of a person.

Read descendants to discover information about offspring or children.

####Sample Code—Read Current User

In your browser, access the read-descendants.php file in your PHP SDK project directory (at http://localhost:5000/read-descendants.php if you are using the embedded server), and examine the information displayed.

#Congratulations!

You have just used two of the Person Read resources to crawl up and down the FamilySearch Family Tree using the FamilySearch PHP SDK.

For more PHP SDK sample code see the PHP SDK functional test suite.

Home

Tutorial

  • Step 1: Register
  • Step 2: Set up your test environment
  • Step 3: Build tutorial.php
  • Step 4: Use the SDK Documentation

Sample App

Documentation

Design

Clone this wiki locally