APIs & Integrations

ar-hz
Member

Is there a PHP library?

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’;

0 Upvotes
12 Replies 12
kasparp
Member

Is there a PHP library?

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).

0 Upvotes
Not applicable

Is there a PHP library?

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.

crg
Member

Is there a PHP library?

Hello Ryan,

I'm trying to use hubspot-php library but I have some problems. It's all fine when creating a contacts object but then I can not call any function; getting a Http 500

require 'vendor/autoload.php';

use SevenShores\Hubspot\Http\Client;
use SevenShores\Hubspot\Resources\Contacts;

$client = new Client(['key' => 'demo']);

$contacts = new Contacts($client);
$contact = $contacts->getByEmail("bh@hubspot.com"); //not working

Can u pls give me an advice?

 

Thx

0 Upvotes
fcedillo
Member

Is there a PHP library?

replace 'demo' with your API Key string

ar-hz
Member

Is there a PHP library?

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

0 Upvotes
Not applicable

Is there a PHP library?

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

0 Upvotes
ar-hz
Member

Is there a PHP library?

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

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Is there a PHP library?

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

3PETE
HubSpot Employee
HubSpot Employee

Is there a PHP library?

@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

0 Upvotes
ar-hz
Member

Is there a PHP library?

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.

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Is there a PHP library?

@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

0 Upvotes
ar-hz
Member

Is there a PHP library?

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:

0 Upvotes