About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
PHP Sample Code
How to use
IBM Video Streaming provides an example PHP library for some basic API calls. Here you can find what’s needed to run the example calls and also download the library.
Prerequisites
You need PHP, and Composer to install the dependencies. The dependencies are defined in the composer.json file.
If you have the dependencies installed, you can run the script with the following command:
php ustream_api.php
You need a IBM Video Streaming account with API credentials, and you have to specify:
- your username
- your password
- your client id
- your client secret
- a video id
At certain points in the script you will notice capitalized texts between angle brackets, like <VIDEO ID>
. That’s what needs to be changed to actual user info.
You also need to specify the name of the video file you want to upload. The video must be in the same folder as the script.
Library contents
The PHP library contains examples for the following endpoints:
- Authentication
- List channels
- List videos
- Upload a video
- Download a video
- Request a downloadable video