Search in documentation:     Advanced search
Browse by category:

Uploading videos from server side

Views: 632
Votes: 0
Posted: 17 Aug, 2009
Updated: 17 Nov, 2009
Description:

The aim of this sample is to show how to use curl to upload a video file in PHP with kewego APIs.

Technical specifications:

Programming language PHP
Requirements Operating system : All
Advised developping environnement : LAMP or WAMP
PHP Version: PHP 5 or upper
Needed Extensions : Curl
Download ( Version 1.0.0)
 Download code sample

Instructions :

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The sample contains 8 files :

- config.php : configuration file (fill in your datas like application key and login/password).
- init.php : use to initialize needed datas to make an upload : getting an application Token and an authToken (login).
- functions.php : contains functions in use in init.php
- KCurl.class.php : Contains the needed curl class to make other API calls than upload in this sample.
- index.php : HTML form : fill in XML data file and video to upload
- upload_curl.php : upload video and asociated datas from form, using curl (KCurl.class.php is not used here for sample purpose and to simplify code reading)


Configuration
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The sample must be configurated to correspond with your own Kewego video portal account :

Edit the config.php file in the config directory and fill in your datas :

- ApplicationKey : identifies your product. All pages will then correspond to your own kewego product datas. If your are using a free key, you will have results from kewego portal.o skin will be shown instead.
- e-mail adress and password need to be set to login.
- Temporary path on the server should be declared

WORKING :
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The video file to upload and the asociated datas are sent by index.php to upload_curl.php.

initialisation is made by init.php file included in upload_curl.php (getting application token and login).

Then upload_curl.php uploads video file and asociated datas from XML file.

  IMPORTANT NOTICES:

1) Settings of PHP servers and curl extension are very important. Please check for instance maximum file size and time out properties.

2) In this sample, AppToken is set into session, and we check its validity to show the app/checkToken API call. This is not compulsory at all because Token is available for 24 hours.
Apptoken can thus be saved on the server side each day for example (database and/or cache). If you use an unlimited Application key, you won't have any restriction in API calls with one single generated Apptoken during 24 hours.
It is also possible to catch Apptoken error returned by API calls and then ask for a new one when needed.

Please check the article about Application key and Application token here
Others in this Category
document Using CURL for distant call
document Simple video portal code sample
document Batch Kad image uploader
document Webcam recorder PHP demo



RSS