To access Web Services using the sample PHP client application, follow these instructions.
Environment
To set up your PHP environment, install the following:
Note: Contact your system administrator if you need help setting up your PHP environment.
Source Code and Sample Data
For PHP, the source code zip file includes:
- YahooAPTClient.php - PHP client application source code.
- sample_data_US.properties - Sample data.
- creative.zip - Zipped creatives.
- video_creative.wmv - Video creative.
- alternate_img.gif - Alternate image.
Build and Run
To build and run the PHP client application:
- Download YahooAPTClient-PHP.zip file, unzip the file, and copy them to your local directory.
Ensure that creative.zip, alternate_img.gif, and video_creative.wmv files are in the same directory. - Edit the YahooAPTClient.php file to insert your Web Services credentials:
- EWS_USERNAME - Web Services user name.
- EWS_PASSWORD - Web Services password.
- EWS_ACCOUNT_ID - Web Services account ID.
- EWS_LICENSE - Web Services license.
-
Run the application using this command:
prompt> php YahooAPTClient.php
Known Issues
If you encounter PHP Warning: file(): open_basedir restriction in effect. File(./sample_data_US.properties) is not within the allowed path(s): (/home/y/share/htdocs/:/home/y/share/pear/:/tmp/) in /home/ws/apt_sample_code/php/YahooAPTClient.php~ on line 608
For this error:
- Modify the php.ini file.
- Edit line open_basedir = ....
- Add :./ to the end of the line.
The PHP language does not support the 64 bit long data type. The maximum integer value in PHP is 2147483647. This limitation can cause PHP applications to generate bad requests if the 64 bit long data type is larger than 2147483647.
Please consider the following rules when writing PHP applications for Web Services.
- When an ID is represented as a string variable, cast it to float to ensure that values larger than 2147483647 are handled correctly.
- When an ID is represented as a numeric variable, the PHP runtime automatically casts large values to float.