This code and these examples were written using PHP verison 5.2.13. PHP was configured with the --with-curl option and JSON enabled. See PHP JSON and PHP cURL for the details of the PHP functions.
As of October 2014, SSL v3 is no longer supported for secure_token requests. You can ensure this is enabled by calling "curl_setopt($connection, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);" - note that you may also need to add "CURLOPT_SSL_CIPHER_LIST => 'TLSv1'" to your PPHttpConfig.php - as described in this StackOverflow answer.
The fetchToken API call does not have ANY inputs. This call is a secure API request and requires the dev name and cert name headers. Set the HTTP headers in $headers. Use CURL to send the API request. Decode the JSON response into an associative array $response. Print the token. Print the full response.
Add an item to Bonanza by providing the title, price, quantity, description, picture, category and shipping. You will also need to provide an authorization token in the $args. Build the API request in a simple associative array in $args. JSON encode the $args in the variable $post_fields. This call is a secure API request and requires dev name and cert name headers. Set the HTTP headers in $headers. Use CURL to send the API request. Decode the JSON response into an associative array $response. Print out the item ID. Print the full response.
Adding multiple fixed price items is like adding a single item with the addition of adding each item to an outer items array.
Revise item 24018227 to update the title, price and quantity. You will also need to provide an authorization token in the $args. Build the API request in a simple associative array in $args. JSON encode the $args in the variable $post_fields. This call is a secure API request and requires dev name and cert name headers. Set the HTTP headers in $headers. Use CURL to send the API request. Decode the JSON response into an associative array $response. Print the full response.
Get the details of the unlisted item with the item ID of 24018222. You will also need to provide an authorization token in the $args. Build the API request in a simple associative array in $args. JSON encode the $args in the variable $post_fields. This call is a secure API request and requires dev name and cert name headers. Set the HTTP headers in $headers. Use CURL to send the API request. Decode the JSON response into an associative array $response. Print the full response.
[description] => This item is great.  Any html here.
The updateBooth call has only 1 input, which is the token. Build the API request in a simple associative array in $args. JSON encode the $args in the variable $post_fields. This call is a secure API request and requires dev name, cert name, and an authorization token. Set the HTTP headers in $headers. Use CURL to send the API request. Decode the JSON response into an associative array $response. Print the response.
Get the checkout link for 3 items 404027,404175 and 23997948. Build the API request in a simple associative array in $args. JSON encode the $args in the variable $post_fields. This call is a standard API request and requires only a dev name header. Set the HTTP headers in $headers. Use CURL to send the API request. Decode the JSON response into an associative array $response. Print out the link. Print the full response.
Get the feedback and rating information for the user with the ID of "hollee". Build the API request in a simple associative array in $args. JSON encode the $args in the variable $post_fields. This call is a standard API request and requires only a dev name header. Set the HTTP headers in $headers. Use CURL to send the API request. Decode the JSON response into an associative array $response. Print out the users rating and star information. Print the full response.
Get the data for the Bonanza item ID 23266642. Build the API request in a simple associative array in $args. JSON encode the $args in the variable $post_fields. This call is a standard API request and requires only a dev name header. Set the HTTP headers in $headers. Use CURL to send the API request. Decode the JSON response into an associative array $response. Print the response.
[description] => Red Crochet Beret Winter Hat, brand new. One size fits most. Other colors available in store.
Get the data for 2 Bonanza items with IDS of 404027 and 404175. Build the API request in a simple associative array in $args. JSON encode the $args in the variable $post_fields. This call is a standard API request and requires only a dev name header. Set the HTTP headers in $headers. Use CURL to send the API request. Decode the JSON response into an associative array $response. Loop thru the returned data and print the price and title of each item. Print the full response.
Get the booth for the user ID "rooms_delivered". Build the API request in a simple associative array in $args. JSON encode the $args in the variable $post_fields. This call is a standard API request and requires only a dev name header. Set the HTTP headers in $headers. Use CURL to send the API request. Decode the JSON response into an associative array $response. Print the response.
Retrieve items from a specified booth by providing the booth id and - optionally - the statuses of the items you want returned. You can page through all items in a booth by also specifying the page number to retrieve and/or the number of items to list per page. You will also need to provide an authorization token in the $args.
Build the API request in a simple associative array in $args. JSON encode the $args in the variable $post_fields. This call is a secure API request and requires dev name and cert name headers. Set the HTTP headers in $headers. Use CURL to send the API request. Decode the JSON response into an associative array $response. Print out the item ID. Print the full response.
$args['requesterCredentials']['bonanzleAuthToken'] = $token;   // only necessary if specifying an itemStatus other than "for_sale"
Get the child categories of the "Baby" category (ID 2984). Build the API request in a simple associative array in $args. JSON encode the $args in the variable $post_fields. This call is a standard API request and requires only a dev name header. Set the HTTP headers in $headers. Use CURL to send the API request. Decode the JSON response into an associative array $response. Loop thru the data and print child category ID and Name. Print the response.
Get the traits for the category "Books >> Fiction Books" (ID 377). This is a LEAF category. Build the API request in a simple associative array in $args. JSON encode the $args in the variable $post_fields. This call is a standard API request and requires only a dev name header. Set the HTTP headers in $headers. Use CURL to send the API request. Decode the JSON response into an associative array $response. Loop thru the data and print trait ID and label. Print the response.
Find the items on Bonanza related to the keywords "Levis Boot Cut" and show page 1 with 5 on a page. Build the API request in a simple associative array in $args. JSON encode the $args in the variable $post_fields. This call is a standard API request and requires only a dev name header. Set the HTTP headers in $headers. Use CURL to send the API request. Decode the JSON response into an associative array $response. Loop thru the data and print item location and title. Print the full response.
Specify the delivery endpoint to receive notifications, and list the notifications to subscribe to (e.g. "askSellerQuestion"). Build the API request in a simple associative array in $args. JSON encode the $args in the variable $post_fields. This call is a secure API request and requires dev name and cert name headers. Set the HTTP headers in $headers. Use CURL to send the API request. Decode the JSON response into an associative array $response. Print the full response.
These 4 functions will help to make API calls using PHP. You can hide a lot of the details when making an API call. See the sample usage below.
# $post_fields - string - data that will be posted to the $url.
Use the Bonapitit functions (above) to update the booth. Build the $request. Make the secure API call. Use JSON to decode the response. Print the full response.
Use the Bonapitit functions (above) to get the item ID 23266642. Build the getSingle Item $request. Make the standard API call. Use JSON to decode the response. Print the full response.