Hi.
I'm Jeffrey Sham with the Google
Developer Relations Team.
In this video, I'll show you how to get started with the
DoubleClick For Publishers API PHP Client Library, from
downloading the code to running examples, and also
tips like what has changed in the login configuration and
where to find the log files.
For new users, I'd recommend taking a look at the Getting
Started Guide.
Here you will find resources for account signup, setup
information for different programming languages, as well
as other developer resources.
From here we will navigate to client libraries and start
from the QuickStart Guide provided for PHP.
One of the first things you need to do is make sure your
system meets the requirements to use the client library.
For PHP, we need Version 5.2 with date of sub-client, and
the sub-client, openness to cell, and curl extensions.
So let's go ahead and download the client library
from the code site.
This is the project homepage for the client library, and it
contains up-to-date
information on version releases.
You can go to the Wiki tab for additional information, Issues
tab for bug tracking, and Source tab for instructions on
how to check out the code through a version control
system, or just to view the code online.
Now let's go to Downloads and get the most recent version of
the client library.
The most current library will have the
featured library label.
So we click on the file link.
Wait for the download to finish.
Click on the download so it unpacks, and we're almost
ready to run some code.
For setup, we go to our client library directory, and then go
to /src/Google/Api/ Ads/Dfp/auth.ini.
And we open that up to put in our information.
Choose Client Login.
All we have to do is fill in the email and password.
It's good practice to have an application name, and the
network code has to be filled in if the user is associated
with more than one network.
With the file saved, our setup is now complete.
Let's take a look at the examples, which are organized
by version and then by service.
Looking at Creative Service, you can see that there are
seven examples that we can run.
Let's take a closer look at the Get Creatives
By Statement example.
You can open the PHP file with an editor of your preference,
but I'd like to show you how to view this file online
through the Client Library Project Site.
So we go to Source, Browse, Examples, choose our version,
our service, and finally, pick our example.
You will notice that many of the examples, like this one,
will have a pattern of creating a DFP user, using it
to create a service, and then using a service
to make an API call.
In this case, we create a DFP user with no arguments.
So we just post the credentials from the auth.ini
that we configured earlier.
We use the Filter Statement with bind variables to specify
that we only want up to 500 Image Creatives.
We call Get Creatives By Statements on the service with
the statement object, and we display the results, one line
per creative, to the command line.
Now let's run this example and see what we get.
To do this, we just have to type php GetCreativesBySt
atementExample.php and hit Enter.
And there we go.
We've successfully retrieved some image creatives.
You can find out more information about the request
from the logs in the Logs Directory.
The Request ID here is really useful for troubleshooting if
you've ever run into problems, and you'd like to post a
question on the forum for us.
You can also configure the level of
logging that you want.
By default, the library captures each request into the
Request Info XML.
Let's change our logging to capture the SOAP Request and
SOAP Response Log as well.
Going back to the command line, we can
run the example again.
Great, the request is finished.
And looking at the Log Directory again, we see now
that there is a soap_xml.log file.
Looking at the log file, you can see the tail end of the
XML response for the Get Creatives By Statement call we
made just now.
So what does it look like if we run into an error?
Let's try it out by changing our filter field to an
incorrect value.
Running the example again, this is what we'll see in the
Request Info Log.
We see that the last call has failed from the isFault=1.
And the Error Details tells us that there was a problem with
our filter statement.
And that's all there is to getting started with the PHP
Client Library.
We have a number of resources available to help you,
including these documentations, FAQs, blogs,
forums, and developer hangouts.
I hope you enjoyed the streamcast and would love to
discuss more through any of these channels.
Just let us know.