Ads API code in PHP



Hi Team,

We are working on making an analysis tool which reads data from a user Ads and campaign page.Our coding language is PHP and all we could found was code in Ruby and Python Ads API. Here we are looking for possible solutions to work with APIs in PHP.

Please let us know how we can achieve the same.(Sample page / Coding link)


@DaisyDemowork: Please see @hector_borras’s PHP library on GitHub.


Hi Juan Shishido,

We are trying that but we are not getting any data for ads account. This is my another twitter account details that i am uusing and that twitter account name is “@testdaniel” and account id is “18ce54hdiwf”

We are getting following error.
Fatal error: Uncaught Hborras\TwitterAdsSDK\TwitterAds\Errors\NotAuthorized: NOT_AUTHORIZED. So can you please let me know how i can authorize my account.

Also i have applied for twitter ads sandbox account but i am not getting any response from your end. Can you please and let us know when my sandbox account will be available for us to develop and test.

Thanks in advance.


@DaisyDemowork: If you’re seeing an authorization error, there is likely an issue with your authentication credentials. Please see this FAQ for additional information.

Usually if it’s an access issue—that is, if you’re waiting for your app to be granted access to use the Ads API—you’d see an UNAUTHORIZED_CLIENT_APPLICATION error. If this is what you’re experiencing, please list your app ID so that the team that handles these requests can take a look. Thanks!


@juanshishido :: Hi , We have created App through different id , which is “@testdaniel” having a app named :: “Appdemostep1”. Having a URL :: “”. and id is “1146149”.

The reason is this account is not given permission to access twitter community. Moreover to it we haven’t identified the reason behind it.

Let us know what can be done.

we also filled up the form at URL ::" "
but we haven’t received any response yet Please let us know where it has been held up.


Hi @juanshishido,

Could it be related to the last post?


Thank you for applying to the Ads API program. If you applied today, it will take sometime for the log to come through the system. please wait and once the data comes we will grant access to you. Thanks!


Yes that was posted by us


Hi OKJ ,

We applied it for this almost a month ago. I would really appreciate if you let us know if there has been any error while filling up the form.

Thanks in advance.


Hi, I went through our log, and couldn’t find your subscription. Can you reapply to the program one more time?
Thank you