Contents
- Description
- API access
- Authorization
- Commands
- Integration with your website (complete solution)
- Problems and solutions
Description
API helps software developers to access the information in a convenient format. Through the API we provide developers all the information we have about the videos uploaded to us. API allows you to automate the process of content delivery to your site. We provide information in a universal format, JSON. More information about the Web API can be found here.
API access
Access is made by the reference to the script and passing required parameters through a standard GET request over HTTP protocol (port 80).
API script is located at:
http://www.flyflv.com/api
Query pattern should be:
http://www.flyflv.com/api/<Command>/{id}?<parameters>
Record id may not be used unless otherwise provided in command, parameters must be passed as a key=value pairs like GET parameters.
Authorization
To access the api you should be a registered user. Authorization is made by adding two additional variables to the parameters with every API access. Authorization looks like this
http://www.flyflv.com/api/apiCommand/?domain=domain.com&userId=12 domain(string) The domain from which a request is made, must be added to your account here userId(int) Your unique user id can be found in the settings here.
Commands
Optional parameters are marked with an asterisk (*)
getMovie
Returns information on a specific movie
id(int) id of the requested movie with(array) * You can specify what further information about the movie to return. Values: program, paysite, models, comments return array Usage: http://www.flyflv.com/api/getMovie/25?with[]=paysite&with[]=program&with[]=comments&domain=domain.com&userId=12
Will return information on the movie with id 25, paysite, affiliate program, and comments made on the movie.
getBanner
Returns banners information.
id(int)* id of the requested banner paysite(int)* paysite id program(int)* affiliate program id width(int)* banner width height(int)* banner height amount(int)* amount of banners sort(string)* order. Values: rand, last ext(string)* format. Values: gif, swf return array Usage: http://www.flyflv.com/api/getBanner/11?domain=domain.com&userId=12 Returns information about banner with id 25 http://www.flyflv.com/api/getBanner/?paysite=10&width=468&height=60&sort=last&ext=gif&amount=2&domain=domain.com&userId=12 Returns the last two .gif banners with the size 468x60px, which belong to a paysite with id 10
getPaysite
Returns paysite information
id(int) paysite id return array Usage: http://www.flyflv.com/api/getPaysite/3?domain=domain.com&userId=12
Returns paysite information with id 3
getProgram
Returns affiliate program information
id(int) affiliate program id return array Usage: http://www.flyflv.com/api/getProgram/5?domain=domain.com&userId=12
Returns affiliate program information with id 5
getThumbnails
Returns information about thumbs
id(int) movie id amount(int)* thumbs amount, default: 1, max=30 width(int)* thumbs with, default: 320 height(int)* thumbs height, default: 240 allowed sizes WxHpx ('160x120', '240x180', '320x240'); return array Usage: http://www.flyflv.com/api/getThumbnails/35?amount=20&width=240&height=180&domain=domain.com&userId=12
Returns information about 20 thumbs with size 240x180 which belongs to movie id 35
addComment
Adds a comment to the movie
movieId(int) movie id email(string) commenter email name(string) commenter full name comment(string) comment text ip(string) commenter IP address return string, in case of errors returns "404 Not Found" HTTP code in the header. Usage: http://www.flyflv.com/api/addComment/?movieId=53&name=First+Last+Name&email=inbox@domain.com&comment=Comment+text&ip=127.0.0.1&domain=domain.com&userId=12
Adds a comment to the movie with id 53
countComments
Returns number of the comments to the movie
id(int) movie id return int Usage: http://www.flyflv.com/api/countComments/25?domain=domain.com&userId=12
Return the number of comments passed moderation to the movie with id 25
getComments
Returns all the comments to the movie
id(int) movie id return array Usage: http://www.flyflv.com/api/getComments/25?domain=domain.com&userId=12
Returns all the comments to the movie id 25
Integration with your website (complete solution)
Principles
Our platform was originally designed as a tool for webmasters, to help them provide regular content updates on their sites and thus increase their sales. This is impossible without an automated process of content delivery to the site. This chapter will help you integrate our content with your website, thus automate the process of content delivery to your websites.
Free integration script
For quick integration of our content with your website we provide to our partners free integration script that can be found in your account on the Your Domains page. While exporting video from our site, specify the field "Movie Url" in the output format, and you will receive a link to your website. When a user accesses this link, the request is forwarded to a script that parses page template and makes requests to our API. Then it replaces the tags in the template with the information received. After that the page displays to the user and puts it in the cache memory for its rapid output to all subsequent users. The script is provided in open source on the terms "as is", and you can change the code of your choice. You can send us your updated code, and after analyzing it we will publish it for all other users which will thank you!
Setup
*Setting up using Apache web server. In case of other web server, change rewrite rules.
While exporting movies from our website, links to the movies (the field "Movie Url") will be made by the following pattern:
"Movie Url" link pattern: http://Domain/Path/movieId/movie_description Domain, Path - set by the user when adding a new domain, /Path should be with trailing slash at the beginning
This address should point to script on your website which will generate a page with the video (perhaps by requests to our API). To do this, in the domains list near the desired domain name, click the link to the .htaccess file. .htaccess rewrite rules will point the webserver to the script. Create a file called .htaccess in the root of your domain and put the contents found by the ".htaccess" link, editing path to the script.
Example .htaccess RewriteEngine on RewriteRule ^.*Path/([0-9]*)/.*$ /dir/script.php?id=$1
In your case Path will be replaced to be specified by you, and you only need to make changes at the end with the path from the root to your script. In this example, the script is located in a directory dir and has the name script.php.
Now you need to configure the script, extract an archive and edit config.php in any convenient text editor.
#your userId, you can find it in your account in Setting menu or by this link: http://www.flyflv.com/users/edit
define("API_USERID", "0");
#domain where this script will be installed (without www)
define("DOMAIN", "example.com");
#abosulte path to the directory where to store cached pages
define("CACHE_DIR", '/flyflv/client/cache');
#abosulte path to the directory where to store banners
define("BANNERS_DIR", '/flyflv/client/banners');
#the url to banners directory
define("BANNERS_URL", 'http://www.example.com/banners');
#absolute path to template(center)
define("TEMPLATE", '/flyflv/client/template.tpl');
#absolute path to template top
define("TOP_TEMPLATE", "/flyflv/client/top.tpl");
#absolute path to template bottom
define("BOTTOM_TEMPLATE", "/flyflv/client/bottom.tpl");
#do you have(would like to have?) comments in template? values: yes, no
define("COMMENTS", 'yes');
In every line you need to replace your data, change only the end of a line such as
define("API_USERID", "0");
Here you need to replace only 0 to your user id
Make sure that the rights to the directories specified in the configuration is set to read/write. If you do not output comments to videos in the template, please indicate this in the configuration. To verify the configuration, refer to the script with variable configtest:
http://domain.com/dir/script.php?configtest
Template engine
To display video information on your page you need to use special tags. In archive with the script you will also find template examples (template.php, top.php, bottom.php) using some possible tags. Based on these, you can create your own page quickly and easily. The script builds the page based on the three templates: top, center and bottom. The center template is required.
Tags
Tags begins and ends with curly brackets {tag}, the meaning of tags intuitively understood, for example:
{title}, {duration}, {addUser}, {addDate}, {paysite.name}, {program.name}
Complex tags
Inserts multiple data in a row, like movie categories{categories}<a href="/categories/{name|url,lowercase}.shtml">{name}</a>{delim}, {delim}{categories}
Such tags begins and ends with the tag name, first goes a pattern for information output, before the closing tag specifies an additional tag {delim} which indicates a separator pattern if more than one record found. If there are two categories "Milf" and "Big Tits" this complex tag will display
<a href="/categories/milf.shtml">Milf</a>, <a href="/categories/big+tits.shtml">Big Tits</a>
Conditional tags
Processed only in case if there is any data. A conditional tag defined with prefix if to the tag name, a conditional tag must have an opening and closing, for example:{iftags}<p><strong>Tags</strong> {tags}<a href="/tags/{name|url,lowercase}.shtml">{name}</a>{delim}, {delim}{tags}</p>{iftags}
This block will be executed only if the video belongs to any tags.
Template example
<h1>{title}</h1>
<p><iframe src="{embedUrl}" width="940" height="529" scrolling="no" frameborder="0">Your browser must support iframes to play this video.</iframe></p>
<p><strong>Duration</strong> {duration|niceTime}</p>
<p><strong>Added by</strong> {addUser}</p>
<p><strong>Add Date</strong> {addDate|niceDate}</p>
{ifmodels}<p><strong>Models</strong> {models}<a href="/models/{id}/{name|url,lowercase}.shtml">{name}</a>{delim}, {delim}{models}</p>{ifmodels}
<p><strong>Categories</strong> {categories}<a href="/categories/{name|url,lowercase}.shtml">{name}</a>{delim}, {delim}{categories}</p>
{iftags}<p><strong>Tags</strong> {tags}<a href="/tags/{name|url,lowercase}.shtml">{name}</a>{delim}, {delim}{tags}</p>{iftags}
<p><strong>Paysite</strong> <a href="/paysite/{paysite.id}/{paysite.name|url,lowercase}.shtml">All movies of {paysite.name}</a></p>
<p><strong>Subscriptions</strong> {program.subscriptions}<a href="{paysite.joinPageUrl}">{price}{program.currency} for {days} days</a>{delim}, {delim}{program.subscriptions}
<p><strong>Network</strong> {program.name} ({program.paysitesAmount} sites)</p>
<h1><a href="{paysite.joinPageUrl}" target="_blank">Join {paysite.name} now!</a></h1>
{ifbanner.url}<p><a href="{paysite.url}" target="_blank"><img src="{banner.url|width=468&height=60&sort=last&ext=gif}"></a></p>{ifbanner.url}
<p><strong>Comments</strong></p>
{comments}
<p id="comments">
<strong>{name}</strong>, {date|niceDate} wrote<br/>
- {comment}
</p>
{delim}
{delim}{comments}
<p>
<h2>Leave your comment</h2>
<p style="display:none;" id="message"></p>
<form action="" method="POST">
<p><strong>Your Name</strong><br /><input type="text" name="name" size="30" id="name"></p>
<p><strong>Email</strong><br /><input type="text" name="email" size="30" id="email"></p>
<p><TEXTAREA name="comment" cols="30" rows="3" id="comment"></TEXTAREA></p>
<p><input type="submit" value="Add comment" class="submit"></p>
</form>
</p>
it's important to end the comment tag with
{delim}{comments}
Modifiers
To all the simple tags in a template you can apply modifiers to convert output data to the appropriate format. Currently there are five modifiers: url, date, niceDate, niceTime, lowercase. The modifier is specified with a tag separated by vertical bar (|). You can apply as many modifiers as you want to one tag, listing them separated by commas (,)
url converts the text to the URL format, usually for use in links, with function urlencode() niceDate converts the unix timestamp to the user-friendly format such as 2 days ago date converts the unix timestamp to the readable format, example: 2024-11-22 niceTime converts a number of seconds to a user-friendly format such as 3min 5sec lowercase converts a string to lower case Examples {duration|niceTime} {addDate|niceDate} {paysite.name|url,lowercase}
Including third party content
To include any files into your templates (like toplists) or cgi scripts, use php includes as on example.
<?php include ('/path/from/the/server/root/toplist.html');?>
To include cgi files, you can use virtual()
<?php virtual('/path/from/domain/root/cgi-bin/script/in.cgi');?>
Problems and solutions
I can not access script by user-fiendly url like http://domain.com/path/id/description. I'm getting 404 Not Found or 500 error.
All of the above configurations will work on an Apache web server. If you have another web server like nginx, you need to rewrite the rules for nginx like in the .htaccess file. Also make sure that the rewrite module is enabled on the web server and operating normally. Make sure that the path to the script in the rewrite rule is correct from the root of your domain. Error 500 most likely indicates a problem with the syntax of the .htaccess file.
Who can I contact for help or more information?
You can always ask us for help via our contact form. We also appreciate your suggestions and comments.