Hi folks,
I have been trying to figure this out for the last few days, and it's really getting me nowhere. I'm pretty new to PHP and really new to cURL.
I'm trying to connect to my highrise account via their API
I'm trying to implement this through php. Browsing their forums, I came across these two code examples and they work fine:
<?php
$request = '<person>
<first-name>John</first-name>
<last-name>Doe</last-name>
<title>CEO</title>
<company-name>Doe Inc.</company-name>
<background>A popular guy for random data</background>
<contact-data>
<email-addresses>
<email-address>
john.doe@example.com
<location>Work</location>
</email-address>
</email-addresses>
<phone-numbers>
<phone-number>
<number>555-555-5555</number>
<location>Work</location>
</phone-number>
<phone-number>
<number>555-666-6666</number>
<location>Home</location>
</phone-number>
</phone-numbers>
</contact-data>
</person>';
// Create Headers
$header[] = "Content-type: application/xml";
$ch = curl_init("http://rattletree.highrisehq.com/people.xml");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERPWD, "activationtoken:password");
curl_setopt($ch, CURLOPT_GET, TRUE); // Set cUrl to post
curl_setopt($ch, CURLOPT_HTTPHEADER, $header ); //Include the head info – this is important must be application/xml
curl_setopt($ch, CURLOPT_POSTFIELDS, $request); //includes the xml request
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 ); // return into a variable
$data = curl_exec($ch);
curl_close($ch);
echo $data;
If you only want to retrieve information it would look more like this:
$ch = curl_init("http://rattletree.highrisehq.com/people.xml");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_USERPWD, "activation-token:password");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 ); // return into a variable
$data = curl_exec($ch);
curl_close($ch);
echo $data;
?>
So the first example above will create a new contact in highrise, and the second example will get all the contacts and almost all their details.
What I'm trying to do is figure out how to modify the second example to also include the "notes" that are associated with a user...
This page shows it is available in the API, but I just don't know enough of PHP or cURL to put the pieces together.
I really appreciate any help.
I'm not wanting to tackle this yet, but in case it changes the solution, once I get all this data, I will be parsing it and putting it in my own backup mySQL.
Thanks,
Joel