Is there a PHP library?

contacts

#1

I have tried https://github.com/HubSpot/haPiHP library which did not work out for me.

	require_once "haPiHP/class.contacts.php";
$HAPIKey = "cbxxxxea-xxxx-xxxx-xxxx-xxxa8axxxx98";
$contacts = new HubSpot_Contacts($HAPIKey);
$contacts_recent_batch1 = $contacts->get_recent_contacts('');

echo "<pre>";
print_r($contacts_recent_batch1);
echo "</pre>";

Above code returns an empty array.

Please guide.

EDIT: above code works when I have
$HAPIKey = ‘demo’;


#2

@ar-hz I don’t believe that repository is up to date. It was last worked on in October of 2015. Did you choose php for that library or do you have experience coding in php


#3

Thanks @pmanca We have a platform based on PHP and I need to integrate Hubspot with it. Therefore, I needed the PHP library. Is there a JS library tho?

If this library is outdated then I guess I just have to write the CURL method and make my own client-library?

Thanks again.


#4

@ar-hz The best way might be able to make your own CURL methods, and client-library.

I have written a node.js library here which I can help you out with if you choose to go that route. I’d also be more then happy to work with you through PHP. I just can’t speak to that specific php library.

https://www.npmjs.com/package/hubspot-api-wrapper


#5

ok thanks. Node.js might be a no go for me. I am gonna create a php-client library. I will post here if I have any questions.

Thanks for your help :slight_smile:


#6

FYI: https://github.com/HubSpot/haPiHP still works. I had the API Key wrong earlier. So far I have only tested the forms endpoint.


#7

@ar-hz Perfect I’m glad it is still working for you! Thanks for the heads up on it.


#8

I think this is by far a much better PHP library to use the hubspot API. It is up-to-date and very intuitive. It also cover almost every API that hubspot provides.


#9

I could not make this to work on my localhost (wamp on Windows).
Maybe because I did not have Guzzle.


#10

I don’t mean to interfere with how you code your project. But you sound to me not using composer. If you are using composer, you should have no issue with the dependency of Guzzle.

Please follow this link to install composer: https://getcomposer.org/doc/00-intro.md#installation-windows

And then you can install hubspot-php:

  1. open your Command Prompt,
  2. go to your project folder,
  3. type in ‘composer require “ryanwinchester/hubspot-php:~1.0”’
  4. wait…wait…and wait… (you then will see composer.json, composer.lock and vendor folder created)
  5. include the autoload.php inside vendor folder
  6. you are good to go

There are other settings and adjustments and stuff, but once you get used to using composer, your coding experience should be much better than now.

hope this help


#11

Thanks a lot @phena109! I got nicely with this library all the contact data (except profile_token and profile_url that return value 0 for me) but can't find any example code to move on with updating contact data by vid or email when it's updated externally.

PS. I'm also trying to sync Hubspot (or something else you suggest - checking also Zoho and some others - haven't picked the one yet) and our external system in the way that we check the contact's last updated date and overwrite the older with newer if the date isn't equal. Only thing I know we can't get via API from HubSot is avatar but that's not an issue if we can send avatar to HubSpot via API (not sure about that yet).