X
Help
Map
Send Request
My Station Schedule
Yomansports.com API
Our API allows developers to create custom applications for yomansports.com. This is version one of our API methods as the site expands we will be adding more methods. You will need to create an API key to access the API. You can get your own API key in your user locker control panel. Once you are assigned your key you are ready to go.
We have listed all the API methods and their descriptions plus sample applications. We are looking to add more applications samples and you are willing to share your code with the yoman community, send your application to our channel administrators.
API Sections
API Video Section
This section contains all of the API methods to access yomansports.com videos.
Video API Methods
To get the Channel Videos

yomansports.videos.byChannelName

Arguments
api_key (Required).Your API application key.

username (Required).Your yomansports username.

channel_name (Required).
To get the Videos by Search Tag or Text

yomansports.videos.search

Arguments
api_key (Required).Your API application key.

username (Required).Your yomansports username.

tag (Optional) A comma-delimited list of tags. Videos with one or more of the tags listed will be returned.

tag_mode (Optional) Either 'any' for an OR combination of tags, or 'all' for an AND combination. Defaults to 'any' if not specified.

text (Optional) A free text search. Videos who's title, description or tags contain the text will be returned.
To get the user's Videos

yomansports.video.byUserName

Arguments
api_key (Required).Your API application key.

username (Required).Your yomansports username.
To get the Video Comments

yomansports.video.comment.byVideoID
Arguments
api_key (Required).Your API application key.

username (Required).Your yomansports username.

video_id (Required) to get video comment.
Video Sample Application

                                <?php
                                        
// A simple script to get videos from yomansports by username.
                                        // It uses the yomansports API to get all data from yomansports.
                                        // By using username, it gets video detail from yomansporst
                                        // IMPORTANT: get a yomansports API key from here [ http://www.yomansports.com/my_profile.php ]
                                        
                                        
                                        
$api_key "Your yomansports API key";
                                        
                                        if(!isset(
$_POST["username"])){
                                            echo 
"<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
                                            echo 
"enter your YomanSports user name <input type=\"text\" name=\"username\"><input type=\"Submit\" value=\"search for yomansports videos by this user\">";
                                            echo 
"</form>";
                                            exit;
                                        } else {
                                            
getYomanvideos($_POST["username"]);
                                        }
                                        
                                        function 
getYomanvideos($username,$page=1,$page_limit 10) {
                                            global 
$api_key$count;
                                        
                                          
// ######## Get user_id given username
                                        
                                          // ######## Build the API request to look up the yoman user_id
                                          
$params = array(
                                            
"api_key"    => $api_key,
                                            
"method"    => "yomansports.video.byUserName",
                                            
"username"    => $username,
                                            
"page" => $page,
                                            
"page_limit" => $page_limit
                                            
);
                                        
                                          
$encoded_params = array();
                                          foreach (
$params as $k => $v){
                                              
$encoded_params[] = urlencode($k)."=".urlencode($v);
                                          }
                                          
//$url = "http://api.yomansports.com/services/?".implode("&", $encoded_params);
                                          
$url "http://www.yomansports.com/api/".implode("&"$encoded_params);
                                          
// As some PHP hosts switch off file_get_contents, here we check to see if curl is installed and use that instead.
                                            
if(function_exists("curl_init")){
                                                
$detail=curl_init($url);
                                                
curl_setopt($detailCURLOPT_HEADERfalse);
                                                
curl_setopt($detailCURLOPT_RETURNTRANSFERtrue);
                                                
$rsp=curl_exec($detail);
                                                
curl_close($detail);
                                            } else {
                                                
$rsp file_get_contents($url);
                                            }
                                            
$array simplexml_load_string($rsp);
                                            
                                            if(
$array["status"] == "fail") {
                                                if(
$array["error_code"] == 1)
                                                {
                                                    echo 
"<b>The API key passed was not valid or has expired. - try again</b><br />";
                                                }
                                                elseif(
$array["error_code"] == 2)
                                                {
                                                    echo 
"<b>User name is not valid - try again</b><br />";
                                                }
                                                elseif(
$array["error_code"] == 3)
                                                {
                                                    echo 
"<b>The requested method was not found - try again</b><br />";
                                                }
                                            echo 
"<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
                                            echo 
"enter your YomanSports user nam <input type=\"text\" name=\"username\"><input type=\"Submit\" value=\"search for yomansports videos by this user\">";
                                            echo 
"</form>";
                                            exit;
                                            }
                                            else {
                                                
$totalCount $array->videos["total"];
                                                if(
$totalCount == 0){
                                                echo 
"<b>no videos found - try again</b><br />";
                                                echo 
"<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
                                                echo 
"enter your YomanSports user name <input type=\"text\" name=\"username\"><input type=\"Submit\" value=\"search for yomansports videos by this user\">";
                                                echo 
"</form>";
                                                exit;
                                            }
                                            else {
                                                if(
$page==1){
                                                    echo 
"Found a total of ".$array->videos["total"]." videos<br />";
                                                }
                                                echo 
"Page ".$page." of ".ceil($array->videos["total"]/$page_limit)."<br />";
                                                echo 
"<hr>";
                                                foreach (
$array->videos->video as $video){
                                                    echo 
"Title: <b>".$video["title"]."</b><br />";
                                                
// display the thumbnail
                                                
echo "<img src=".$video["img_src"]."><br clear=\"left\" />";
                                        
                                                
// original video page url with link
                                                
echo "<a href=\"".$video["ind_page_link"]."\">".$video["ind_page_link"]."</a><br clear=\"left\" />";
                                                
                                                echo 
"Description: ".$video["description"]."<br clear=\"left\" />";
                                                
                                                echo 
"Views: ".$video["views"]."<br clear=\"left\" />";
                                                
                                                echo 
"keyword: ".$video["keyword"]."<br clear=\"left\" />";
                                                
                                                echo 
"Add Date: ".$video["add_date"]."<br clear=\"left\" />";
                                                
                                                echo 
"Added By: <a href=\"".$video["profile_link"]."\">".$video["username"]."</a><br clear=\"left\" />";
                                                
                                                
$params = array(
                                                          
"api_key"    => $api_key,
                                                          
"method"    => "yomansports.video.comment.byVideoID",
                                                          
"username"    => $username,
                                                          
"video_id"        => $video["VID"]
                                                      );
                                                      
                                                      
$encoded_params = array();
                                                      foreach (
$params as $k => $v){
                                                          
$encoded_params[] = urlencode($k)."=".urlencode($v);
                                                      }
                                                        
//$url = "http://api.yomansports.com/services/?".implode("&", $encoded_params);

                                                        
$url "http://www.yomansports.com/api/".implode("&"$encoded_params);
                                                        if(
function_exists("curl_init")){
                                                          
$detail=curl_init($url);
                                                          
curl_setopt($detailCURLOPT_HEADERfalse);
                                                          
curl_setopt($detailCURLOPT_RETURNTRANSFERtrue);
                                                          
$rsp_comment=curl_exec($detail);
                                                          
curl_close($detail);
                                                      } else {
                                                          
$rsp_comment file_get_contents($url);
                                                      }
                                                        
$array_comment simplexml_load_string($rsp_comment);
                                                        if(
$array_comment->comments["total"] == 0) {
                                                            echo 
"There are no comments for this video<br /><hr>";
                                                        }
                                                        else {
                                                            echo 
"<ul>";
                                                            foreach (
$array_comment->comments->comment as $comment){
                                                                echo 
"<li>[".$comment["username"]."] ".$comment["vdo_comment"]."</li>";
                                                            }
                                                            echo 
"</ul><br /><hr>";
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    
                                    
?>
                                    
Videos By Channel Name Sample Application

                                <?php
                                        
// A simple script to get videos from yomansports by username.
                                        // It uses the yomansports API to get all data from yomansports.
                                        // By using username, it gets video detail from yomansporst
                                        // IMPORTANT: get a yomansports API key from here [ http://www.yomansports.com/my_profile.php ]
                                        
                                        
$api_key "Your yomansports API key";
                                        
                                        if(!isset(
$_POST["username"])){
                                            echo 
"<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
                                            echo 
"enter your YomanSports user name <input type=\"text\" name=\"username\"><input type=\"Submit\" value=\"search for yomansports videos by this user\">";
                                            echo 
"</form>";
                                            exit;
                                        } else {
                                            
getYomanvideos($_POST["username"]);
                                        }
                                        
                                        function 
getYomanvideos($username,$page=1,$page_limit 10) {
                                            global 
$api_key$count;
                                        
                                          
// ######## Get user_id given username
                                        
                                          // ######## Build the API request to look up the yoman user_id
                                          
$params = array(
                                            
"api_key"    => $api_key,
                                            
"method"    => "yomansports.videos.byChannelName",
                                            
"username"    => $username,
                                            
"page" => $page,
                                            
"page_limit" => $page_limit,
                                            
"channel_name" => "channel Name"
                                            
);
                                        
                                          
$encoded_params = array();
                                          foreach (
$params as $k => $v){
                                              
$encoded_params[] = urlencode($k)."=".urlencode($v);
                                          }
                                          
//$url = "http://api.yomansports.com/services/?".implode("&", $encoded_params);
                                          
$url "http://www.yomansports.com/api/".implode("&"$encoded_params);
                                          
// As some PHP hosts switch off file_get_contents, here we check to see if curl is installed and use that instead.
                                            
if(function_exists("curl_init")){
                                                
$detail=curl_init($url);
                                                
curl_setopt($detailCURLOPT_HEADERfalse);
                                                
curl_setopt($detailCURLOPT_RETURNTRANSFERtrue);
                                                
$rsp=curl_exec($detail);
                                                
curl_close($detail);
                                            } else {
                                                
$rsp file_get_contents($url);
                                            }
                                            
$array simplexml_load_string($rsp);
                                            
                                            if(
$array["status"] == "fail") {
                                                if(
$array["error_code"] == 1)
                                                {
                                                    echo 
"<b>The API key passed was not valid or has expired. - try again</b><br />";
                                                }
                                                elseif(
$array["error_code"] == 2)
                                                {
                                                    echo 
"<b>User name is not valid - try again</b><br />";
                                                }
                                                elseif(
$array["error_code"] == 3)
                                                {
                                                    echo 
"<b>The requested method was not found - try again</b><br />";
                                                }
                                            echo 
"<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
                                            echo 
"enter your YomanSports user nam <input type=\"text\" name=\"username\"><input type=\"Submit\" value=\"search for yomansports videos by this user\">";
                                            echo 
"</form>";
                                            exit;
                                            }
                                            else {
                                                
$totalCount $array->videos["total"];
                                                if(
$totalCount == 0){
                                                echo 
"<b>no videos found - try again</b><br />";
                                                echo 
"<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
                                                echo 
"enter your YomanSports user name <input type=\"text\" name=\"username\"><input type=\"Submit\" value=\"search for yomansports videos by this user\">";
                                                echo 
"</form>";
                                                exit;
                                            }
                                            else {
                                                if(
$page==1){
                                                    echo 
"Found a total of ".$array->videos["total"]." videos<br />";
                                                }
                                                echo 
"Page ".$page." of ".ceil($array->videos["total"]/$page_limit)."<br />";
                                                echo 
"<hr>";
                                                foreach (
$array->videos->video as $video){
                                                    echo 
"Title: <b>".$video["title"]."</b><br />";
                                                
// display the thumbnail
                                                
echo "<img src=".$video["img_src"]."><br clear=\"left\" />";
                                        
                                                
// original video page url with link
                                                
echo "<a href=\"".$video["ind_page_link"]."\">".$video["ind_page_link"]."</a><br clear=\"left\" />";
                                                
                                                echo 
"Description: ".$video["description"]."<br clear=\"left\" />";
                                                
                                                echo 
"Views: ".$video["views"]."<br clear=\"left\" />";
                                                
                                                echo 
"keyword: ".$video["keyword"]."<br clear=\"left\" />";
                                                
                                                echo 
"Add Date: ".$video["add_date"]."<br clear=\"left\" />";
                                                
                                                echo 
"Added By: <a href=\"".$video["profile_link"]."\">".$video["username"]."</a><br clear=\"left\" />";
                                                
                                                
$params = array(
                                                          
"api_key"    => $api_key,
                                                          
"method"    => "yomansports.video.comment.byVideoID",
                                                          
"username"    => $username,
                                                          
"video_id"        => $video["VID"]
                                                      );
                                                      
                                                      
$encoded_params = array();
                                                      foreach (
$params as $k => $v){
                                                          
$encoded_params[] = urlencode($k)."=".urlencode($v);
                                                      }
                                                        
//$url = "http://api.yomansports.com/services/?".implode("&", $encoded_params);
                                                        
$url "http://www.yomansports.com/api/".implode("&"$encoded_params);
                                                        if(
function_exists("curl_init")){
                                                          
$detail=curl_init($url);
                                                          
curl_setopt($detailCURLOPT_HEADERfalse);
                                                          
curl_setopt($detailCURLOPT_RETURNTRANSFERtrue);
                                                          
$rsp_comment=curl_exec($detail);
                                                          
curl_close($detail);
                                                      } else {
                                                          
$rsp_comment file_get_contents($url);
                                                      }
                                                        
$array_comment simplexml_load_string($rsp_comment);
                                                        if(
$array_comment->comments["total"] == 0) {
                                                            echo 
"There are no comments for this video<br /><hr>";
                                                        }
                                                        else {
                                                            echo 
"<ul>";
                                                            foreach (
$array_comment->comments->comment as $comment){
                                                                echo 
"<li>[".$comment["username"]."] ".$comment["vdo_comment"]."</li>";
                                                            }
                                                            echo 
"</ul><br /><hr>";
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    
                                    
?>
                                    
Error Codes
Error Code description
1: The API key passed was not valid or has expired.

2: User name is not valid.

3: The requested method was not found.
API Picture Section
This section contains all of the API methods to access yomansports.com pictures.
Picture API Methods
To get the Channel Pictures

yomansports.pictures.byChannelName

Arguments
api_key (Required).Your API application key.

username (Required).Your yomansports username.

channel_name (Required).
To get the Pictures by Search Tag or Text

yomansports.pictures.search

Arguments
api_key (Required).Your API application key.

username (Required).Your yomansports username.

tag (Optional) A comma-delimited list of tags. Pictures with one or more of the tags listed will be returned.

tag_mode (Optional) Either 'any' for an OR combination of tags, or 'all' for an AND combination. Defaults to 'any' if not specified.

text (Optional) A free text search. Pictures who's title, description or tags contain the text will be returned.
To get the user's Pictures

yomansports.picture.byUserName
Arguments
api_key (Required).Your API application key.

username (Required).Your yomansports username.
To get the Picture Comments

yomansports.picture.comment.byPictureID
Arguments
api_key (Required).Your API application key.

username (Required).Your yomansports username.

picture_id (Required) to get picture comment.
Picture Sample Application

                                <?php
                                        
// A simple script to get videos from yomansports by username.
                                        // It uses the yomansports API to get all data from yomansports.
                                        // By using username, it gets video detail from yomansporst
                                        // IMPORTANT: get a yomansports API key from here [ http://www.yomansports.com/my_profile.php ]
                                        
                                        
$api_key "Your yomansports API key";
                                        
                                        if(!isset(
$_POST["username"])){
                                            echo 
"<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
                                            echo 
"enter your YomanSports user name <input type=\"text\" name=\"username\"><input type=\"Submit\" value=\"search for yomansports photos by this user\">";
                                            echo 
"</form>";
                                            exit;
                                        } else {
                                            
getYomanPhotos($_POST["username"]);
                                        }
                                        
                                        function 
getYomanPhotos($username,$page=1,$page_limit 10) {
                                            global 
$api_key$count;
                                        
                                          
// ######## Get user_id given username
                                        
                                          // ######## Build the API request to look up the yoman user_id
                                          
$params = array(
                                            
"api_key"    => $api_key,
                                            
"method"    => "yomansports.picture.byUserName",
                                            
"username"    => $username,
                                            
"page" => $page,
                                            
"page_limit" => $page_limit
                                            
);
                                        
                                          
$encoded_params = array();
                                          foreach (
$params as $k => $v){
                                              
$encoded_params[] = urlencode($k)."=".urlencode($v);
                                          }
                                          
//$url = "http://api.yomansports.com/services/?".implode("&", $encoded_params);
                                          
$url "http://www.yomansports.com/api/".implode("&"$encoded_params);
                                          
                                          
// As some PHP hosts switch off file_get_contents, here we check to see if curl is installed and use that instead.
                                            
if(function_exists("curl_init")){
                                                
$detail=curl_init($url);
                                                
curl_setopt($detailCURLOPT_HEADERfalse);
                                                
curl_setopt($detailCURLOPT_RETURNTRANSFERtrue);
                                                
$rsp=curl_exec($detail);
                                                
curl_close($detail);
                                            } else {
                                                
$rsp file_get_contents($url);
                                            }
                                            
$array simplexml_load_string($rsp);
                                            
                                            if(
$array["status"] == "fail") {
                                                if(
$array["error_code"] == 1)
                                                {
                                                    echo 
"<b>The API key passed was not valid or has expired. - try again</b><br />";
                                                }
                                                elseif(
$array["error_code"] == 2)
                                                {
                                                    echo 
"<b>User name is not valid - try again</b><br />";
                                                }
                                                elseif(
$array["error_code"] == 3)
                                                {
                                                    echo 
"<b>The requested method was not found - try again</b><br />";
                                                }
                                            echo 
"<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
                                            echo 
"enter your YomanSports user nam <input type=\"text\" name=\"username\"><input type=\"Submit\" value=\"search for yomansports photos by this user\">";
                                            echo 
"</form>";
                                            exit;
                                            }
                                            else {
                                                
$totalCount $array->photos["total"];
                                                if(
$totalCount == 0){
                                                echo 
"<b>no photos found - try again</b><br />";
                                                echo 
"<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
                                                echo 
"enter your YomanSports user name <input type=\"text\" name=\"username\"><input type=\"Submit\" value=\"search for yomansports photos by this user\">";
                                                echo 
"</form>";
                                                exit;
                                            }
                                            else {
                                                if(
$page==1){
                                                    echo 
"Found a total of ".$array->photos["total"]." photos<br />";
                                                }
                                                echo 
"Page ".$page." of ".ceil($array->photos["total"]/$page_limit)."<br />";
                                                echo 
"<hr>";
                                                foreach (
$array->photos->photo as $photo){
                                                    echo 
"<b>".$photo["title"]."</b><br />";
                                                
// display the thumbnail
                                                
echo "<img src=".$photo["img_src"]."><br clear=\"left\" />";
                                        
                                                
// original photo page url with link
                                                
echo "<a href=\"".$photo["ind_page_link"]."\">".$photo["ind_page_link"]."</a><br clear=\"left\" />";
                                                
                                                echo 
"Description: ".$photo["description"]."<br clear=\"left\" />";
                                                
                                                echo 
"Views: ".$photo["views"]."<br clear=\"left\" />";
                                                
                                                echo 
"keyword: ".$photo["keyword"]."<br clear=\"left\" />";
                                                
                                                echo 
"Add Date: ".$photo["add_date"]."<br clear=\"left\" />";
                                                
                                                echo 
"Added By: <a href=\"".$photo["profile_link"]."\">".$photo["username"]."</a><br clear=\"left\" />";
                                                
                                                
$params = array(
                                                          
"api_key"    => $api_key,
                                                          
"method"    => "yomansports.picture.comment.byPictureID",
                                                          
"username"    => $username,
                                                          
"picture_id"        => $photo["VID"]
                                                      );
                                                      
                                                      
$encoded_params = array();
                                                      foreach (
$params as $k => $v){
                                                          
$encoded_params[] = urlencode($k)."=".urlencode($v);
                                                      }
                                                        
//$url = "http://api.yomansports.com/services/?".implode("&", $encoded_params);
                                                        
$url "http://www.yomansports.com/api/".implode("&"$encoded_params);
                                                        if(
function_exists("curl_init")){
                                                          
$detail=curl_init($url);
                                                          
curl_setopt($detailCURLOPT_HEADERfalse);
                                                          
curl_setopt($detailCURLOPT_RETURNTRANSFERtrue);
                                                          
$rsp_comment=curl_exec($detail);
                                                          
curl_close($detail);
                                                      } else {
                                                          
$rsp_comment file_get_contents($url);
                                                      }
                                                        
$array_comment simplexml_load_string($rsp_comment);
                                                        if(
$array_comment->comments["total"] == 0) {
                                                            echo 
"There are no comments for this Photo<br /><hr>";
                                                        }
                                                        else {
                                                            echo 
"<ul>";
                                                            foreach (
$array_comment->comments->comment as $comment){
                                                                echo 
"<li>[".$comment["username"]."] ".$comment["pic_comment"]."</li>";
                                                            }
                                                            echo 
"</ul><br /><hr>";
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    
                                    
?>
                                    
Pictures By Channel Name Sample Application

                                <?php
                                        
// A simple script to get videos from yomansports by username.
                                        // It uses the yomansports API to get all data from yomansports.
                                        // By using username, it gets video detail from yomansporst
                                        // IMPORTANT: get a yomansports API key from here [ http://www.yomansports.com/my_profile.php ]
                                        
                                        
$api_key "Your yomansports API key";
                                        
                                        if(!isset(
$_POST["username"])){
                                            echo 
"<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
                                            echo 
"enter your YomanSports user name <input type=\"text\" name=\"username\"><input type=\"Submit\" value=\"search for yomansports photos by this user\">";
                                            echo 
"</form>";
                                            exit;
                                        } else {
                                            
getYomanPhotos($_POST["username"]);
                                        }
                                        
                                        function 
getYomanPhotos($username,$page=1,$page_limit 10) {
                                            global 
$api_key$count;
                                        
                                          
// ######## Get user_id given username
                                        
                                          // ######## Build the API request to look up the yoman user_id
                                          
$params = array(
                                            
"api_key"    => $api_key,
                                            
"method"    => "yomansports.pictures.byChannelName",
                                            
"username"    => $username,
                                            
"page" => $page,
                                            
"page_limit" => $page_limit,
                                            
"channel_name" => "channel name"
                                            
);
                                        
                                          
$encoded_params = array();
                                          foreach (
$params as $k => $v){
                                              
$encoded_params[] = urlencode($k)."=".urlencode($v);
                                          }
                                          
//$url = "http://api.yomansports.com/services/?".implode("&", $encoded_params);
                                          
$url "http://www.yomansports.com/api/".implode("&"$encoded_params);
                                          
// As some PHP hosts switch off file_get_contents, here we check to see if curl is installed and use that instead.
                                            
if(function_exists("curl_init")){
                                                
$detail=curl_init($url);
                                                
curl_setopt($detailCURLOPT_HEADERfalse);
                                                
curl_setopt($detailCURLOPT_RETURNTRANSFERtrue);
                                                
$rsp=curl_exec($detail);
                                                
curl_close($detail);
                                            } else {
                                                
$rsp file_get_contents($url);
                                            }
                                            
$array simplexml_load_string($rsp);
                                            
                                            if(
$array["status"] == "fail") {
                                                if(
$array["error_code"] == 1)
                                                {
                                                    echo 
"<b>The API key passed was not valid or has expired. - try again</b><br />";
                                                }
                                                elseif(
$array["error_code"] == 2)
                                                {
                                                    echo 
"<b>User name is not valid - try again</b><br />";
                                                }
                                                elseif(
$array["error_code"] == 3)
                                                {
                                                    echo 
"<b>The requested method was not found - try again</b><br />";
                                                }
                                            echo 
"<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
                                            echo 
"enter your YomanSports user nam <input type=\"text\" name=\"username\"><input type=\"Submit\" value=\"search for yomansports photos by this user\">";
                                            echo 
"</form>";
                                            exit;
                                            }
                                            else {
                                                
$totalCount $array->photos["total"];
                                                if(
$totalCount == 0){
                                                echo 
"<b>no photos found - try again</b><br />";
                                                echo 
"<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
                                                echo 
"enter your YomanSports user name <input type=\"text\" name=\"username\"><input type=\"Submit\" value=\"search for yomansports photos by this user\">";
                                                echo 
"</form>";
                                                exit;
                                            }
                                            else {
                                                if(
$page==1){
                                                    echo 
"Found a total of ".$array->photos["total"]." photos<br />";
                                                }
                                                echo 
"Page ".$page." of ".ceil($array->photos["total"]/$page_limit)."<br />";
                                                echo 
"<hr>";
                                                foreach (
$array->photos->photo as $photo){
                                                    echo 
"<b>".$photo["title"]."</b><br />";
                                                
// display the thumbnail
                                                
echo "<img src=".$photo["img_src"]."><br clear=\"left\" />";
                                        
                                                
// original photo page url with link
                                                
echo "<a href=\"".$photo["ind_page_link"]."\">".$photo["ind_page_link"]."</a><br clear=\"left\" />";
                                                
                                                echo 
"Description: ".$photo["description"]."<br clear=\"left\" />";
                                                
                                                echo 
"Views: ".$photo["views"]."<br clear=\"left\" />";
                                                
                                                echo 
"keyword: ".$photo["keyword"]."<br clear=\"left\" />";
                                                
                                                echo 
"Add Date: ".$photo["add_date"]."<br clear=\"left\" />";
                                                
                                                echo 
"Added By: <a href=\"".$photo["profile_link"]."\">".$photo["username"]."</a><br clear=\"left\" />";
                                                
                                                
$params = array(
                                                          
"api_key"    => $api_key,
                                                          
"method"    => "yomansports.picture.comment.byPictureID",
                                                          
"username"    => $username,
                                                          
"picture_id"        => $photo["VID"]
                                                      );
                                                      
                                                      
$encoded_params = array();
                                                      foreach (
$params as $k => $v){
                                                          
$encoded_params[] = urlencode($k)."=".urlencode($v);
                                                      }
                                                        
//$url = "http://api.yomansports.com/services/?".implode("&", $encoded_params);
                                                        
$url "http://www.yomansports.com/api/".implode("&"$encoded_params);
                                                        if(
function_exists("curl_init")){
                                                          
$detail=curl_init($url);
                                                          
curl_setopt($detailCURLOPT_HEADERfalse);
                                                          
curl_setopt($detailCURLOPT_RETURNTRANSFERtrue);
                                                          
$rsp_comment=curl_exec($detail);
                                                          
curl_close($detail);
                                                      } else {
                                                          
$rsp_comment file_get_contents($url);
                                                      }
                                                        
$array_comment simplexml_load_string($rsp_comment);
                                                        if(
$array_comment->comments["total"] == 0) {
                                                            echo 
"There are no comments for this Photo<br /><hr>";
                                                        }
                                                        else {
                                                            echo 
"<ul>";
                                                            foreach (
$array_comment->comments->comment as $comment){
                                                                echo 
"<li>[".$comment["username"]."] ".$comment["pic_comment"]."</li>";
                                                            }
                                                            echo 
"</ul><br /><hr>";
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    
                                    
?>
                                    
Error Codes
Error Code description
1: The API key passed was not valid or has expired.

2: User name is not valid.

3: The requested method was not found.
API Training Video Section
This section contains all of the API methods to access yomansports.com training videos.
Training Video API Methods
To get the Training Videos by Search Tag or Text

yomansports.training.video.search

Arguments
api_key (Required).Your API application key.

username (Required).Your yomansports username.

tag (Optional) A comma-delimited list of tags. Training Videos with one or more of the tags listed will be returned.

tag_mode (Optional) Either 'any' for an OR combination of tags, or 'all' for an AND combination. Defaults to 'any' if not specified.

text (Optional) A free text search. Training Videos who's title, description or tags contain the text will be returned.
To get the user's Training Videos

yomansports.training.video.byUserName
Arguments
api_key (Required).Your API application key.

username (Required).Your yomansports username.
To get the Training Video Comments

yomansports.training.video.comment.byVideoID
Arguments
api_key (Required).Your API application key.

username (Required).Your yomansports username.

training_vdo_id (Required) to get training video comment.
Training Video Sample Application

                                <?php
                                        
// A simple script to get videos from yomansports by username.
                                        // It uses the yomansports API to get all data from yomansports.
                                        // By using username, it gets video detail from yomansporst
                                        // IMPORTANT: get a yomansports API key from here [ http://www.yomansports.com/my_profile.php ]
                                        
                                        
$api_key "Your yomansports API key";
                                        
                                        if(!isset(
$_POST["username"])){
                                            echo 
"<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
                                            echo 
"enter your YomanSports user name <input type=\"text\" name=\"username\"><input type=\"Submit\" value=\"search for yomansports videos by this user\">";
                                            echo 
"</form>";
                                            exit;
                                        } else {
                                            
getYomanvideos($_POST["username"]);
                                        }
                                        
                                        function 
getYomanvideos($username,$page=1,$page_limit 10) {
                                            global 
$api_key$count;
                                        
                                          
// ######## Get user_id given username
                                        
                                          // ######## Build the API request to look up the yoman user_id
                                          
$params = array(
                                            
"api_key"    => $api_key,
                                            
"method"    => "yomansports.training.video.byUserName",
                                            
"username"    => $username,
                                            
"page" => $page,
                                            
"page_limit" => $page_limit
                                            
);
                                        
                                          
$encoded_params = array();
                                          foreach (
$params as $k => $v){
                                              
$encoded_params[] = urlencode($k)."=".urlencode($v);
                                          }
                                          
//$url = "http://api.yomansports.com/services/?".implode("&", $encoded_params);
                                          
$url "http://www.yomansports.com/api/".implode("&"$encoded_params);
                                          
//echo $url;
                                          // As some PHP hosts switch off file_get_contents, here we check to see if curl is installed and use that instead.
                                            
if(function_exists("curl_init")){
                                                
$detail=curl_init($url);
                                                
curl_setopt($detailCURLOPT_HEADERfalse);
                                                
curl_setopt($detailCURLOPT_RETURNTRANSFERtrue);
                                                
$rsp=curl_exec($detail);
                                                
curl_close($detail);
                                            } else {
                                                
$rsp file_get_contents($url);
                                            }
                                            
$array simplexml_load_string($rsp);
                                            
                                            if(
$array["status"] == "fail") {
                                                if(
$array["error_code"] == 1)
                                                {
                                                    echo 
"<b>The API key passed was not valid or has expired. - try again</b><br />";
                                                }
                                                elseif(
$array["error_code"] == 2)
                                                {
                                                    echo 
"<b>User name is not valid - try again</b><br />";
                                                }
                                                elseif(
$array["error_code"] == 3)
                                                {
                                                    echo 
"<b>The requested method was not found - try again</b><br />";
                                                }
                                            echo 
"<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
                                            echo 
"enter your YomanSports user nam <input type=\"text\" name=\"username\"><input type=\"Submit\" value=\"search for yomansports videos by this user\">";
                                            echo 
"</form>";
                                            exit;
                                            }
                                            else {
                                                
$totalCount $array->training_vdos["total"];
                                                if(
$totalCount == 0){
                                                echo 
"<b>no videos found - try again</b><br />";
                                                echo 
"<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
                                                echo 
"enter your YomanSports user name <input type=\"text\" name=\"username\"><input type=\"Submit\" value=\"search for yomansports videos by this user\">";
                                                echo 
"</form>";
                                                exit;
                                            }
                                            else {
                                                if(
$page==1){
                                                    echo 
"Found a total of ".$array->training_vdos["total"]." videos<br />";
                                                }
                                                echo 
"Page ".$page." of ".ceil($array->training_vdos["total"]/$page_limit)."<br />";
                                                echo 
"<hr>";
                                                foreach (
$array->training_vdos->training_video as $training_video){
                                                    echo 
"Title: <b>".$training_video["title"]."</b><br />";
                                                
// display the thumbnail
                                                
echo "<img src=".$training_video["img_src"]."><br clear=\"left\" />";
                                        
                                                
// original training_video page url with link
                                                
echo "<a href=\"".$training_video["ind_page_link"]."\">".$training_video["ind_page_link"]."</a><br clear=\"left\" />";
                                                
                                                echo 
"Description: ".$training_video["description"]."<br clear=\"left\" />";
                                                
                                                echo 
"Views: ".$training_video["views"]."<br clear=\"left\" />";
                                                
                                                echo 
"keyword: ".$training_video["keyword"]."<br clear=\"left\" />";
                                                
                                                echo 
"Add Date: ".$training_video["add_date"]."<br clear=\"left\" />";
                                                
                                                echo 
"Added By: <a href=\"".$training_video["profile_link"]."\">".$training_video["username"]."</a><br clear=\"left\" />";
                                                
                                                
$params = array(
                                                          
"api_key"    => $api_key,
                                                          
"method"    => "yomansports.training.video.comment.byVideoID",
                                                          
"username"    => $username,
                                                          
"training_vdo_id"        => $training_video["VID"]
                                                      );
                                                      
                                                      
$encoded_params = array();
                                                      foreach (
$params as $k => $v){
                                                          
$encoded_params[] = urlencode($k)."=".urlencode($v);
                                                      }
                                                        
//$url = "http://api.yomansports.com/services/?".implode("&", $encoded_params);
                                                        
$url "http://www.yomansports.com/api/".implode("&"$encoded_params);
                                        
                                                        if(
function_exists("curl_init")){
                                                          
$detail=curl_init($url);
                                                          
curl_setopt($detailCURLOPT_HEADERfalse);
                                                          
curl_setopt($detailCURLOPT_RETURNTRANSFERtrue);
                                                          
$rsp_comment=curl_exec($detail);
                                                          
curl_close($detail);
                                                      } else {
                                                          
$rsp_comment file_get_contents($url);
                                                      }
                                                        
$array_comment simplexml_load_string($rsp_comment);
                                                        if(
$array_comment->comments["total"] == 0) {
                                                            echo 
"There are no comments for this video<br /><hr>";
                                                        }
                                                        else {
                                                            echo 
"<ul>";
                                                            foreach (
$array_comment->comments->comment as $comment){
                                                                echo 
"<li>[".$comment["username"]."] ".$comment["trv_comment"]."</li>";
                                                            }
                                                            echo 
"</ul><br /><hr>";
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    
                                    
?>
                                    
Error Codes
Error Code description
1: The API key passed was not valid or has expired.

2: User name is not valid.

3: The requested method was not found.
API Sponsored Training Video Section
This section contains all of the API methods to access yomansports.com sponsored training videos.
Sponsored Training Video API Methods
To get the Sponsored Training Videos by Search Tag or Text

yomansports.sponsored.training.video.search

Arguments
api_key (Required).Your API application key.

username (Required).Your yomansports username.

tag (Optional) A comma-delimited list of tags.Sponsored Training Videos with one or more of the tags listed will be returned.

tag_mode (Optional) Either 'any' for an OR combination of tags, or 'all' for an AND combination. Defaults to 'any' if not specified.

text (Optional) A free text search. Sponsored Training Videos who's title, description or tags contain the text will be returned.
To get the Sponsored training Videos

yomansports.sponsored.training.video.byUserName
Arguments
api_key (Required).Your API application key.

username (Required).Your yomansports username.
To get the Sponsored Training Video Comments

yomansports.sponsored.training.video.comment.byVideoID
Arguments
api_key (Required).Your API application key.

username (Required).Your yomansports username.

training_vdo_id (Required) to get sponsored training video comment.
Sponsored Training Video Sample Application

                                <?php
                                        
// A simple script to get videos from yomansports by username.
                                        // It uses the yomansports API to get all data from yomansports.
                                        // By using username, it gets video detail from yomansporst
                                        // IMPORTANT: get a yomansports API key from here [ http://www.yomansports.com/my_profile.php ]
                                        
                                        
$api_key "Your yomansports API key";
                                        
                                        if(!isset(
$_POST["username"])){
                                            echo 
"<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
                                            echo 
"enter your YomanSports user name <input type=\"text\" name=\"username\"><input type=\"Submit\" value=\"search for yomansports videos by this user\">";
                                            echo 
"</form>";
                                            exit;
                                        } else {
                                            
getYomanvideos($_POST["username"]);
                                        }
                                        
                                        function 
getYomanvideos($username,$page=1,$page_limit 10) {
                                            global 
$api_key$count;
                                        
                                          
// ######## Get user_id given username
                                        
                                          // ######## Build the API request to look up the yoman user_id
                                          
$params = array(
                                            
"api_key"    => $api_key,
                                            
"method"    => "yomansports.sponsored.training.video.byUserName",
                                            
"username"    => $username,
                                            
"page" => $page,
                                            
"page_limit" => $page_limit
                                            
);
                                        
                                          
$encoded_params = array();
                                          foreach (
$params as $k => $v){
                                              
$encoded_params[] = urlencode($k)."=".urlencode($v);
                                          }
                                          
//$url = "http://api.yomansports.com/services/?".implode("&", $encoded_params);
                                          
$url "http://www.yomansports.com/api/".implode("&"$encoded_params);
                                          
//echo $url;
                                          // As some PHP hosts switch off file_get_contents, here we check to see if curl is installed and use that instead.
                                            
if(function_exists("curl_init")){
                                                
$detail=curl_init($url);
                                                
curl_setopt($detailCURLOPT_HEADERfalse);
                                                
curl_setopt($detailCURLOPT_RETURNTRANSFERtrue);
                                                
$rsp=curl_exec($detail);
                                                
curl_close($detail);
                                            } else {
                                                
$rsp file_get_contents($url);
                                            }
                                            
$array simplexml_load_string($rsp);
                                            
                                            if(
$array["status"] == "fail") {
                                                if(
$array["error_code"] == 1)
                                                {
                                                    echo 
"<b>The API key passed was not valid or has expired. - try again</b><br />";
                                                }
                                                elseif(
$array["error_code"] == 2)
                                                {
                                                    echo 
"<b>User name is not valid - try again</b><br />";
                                                }
                                                elseif(
$array["error_code"] == 3)
                                                {
                                                    echo 
"<b>The requested method was not found - try again</b><br />";
                                                }
                                            echo 
"<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
                                            echo 
"enter your YomanSports user nam <input type=\"text\" name=\"username\"><input type=\"Submit\" value=\"search for yomansports videos by this user\">";
                                            echo 
"</form>";
                                            exit;
                                            }
                                            else {
                                                
$totalCount $array->sponsored_training_vdos["total"];
                                                if(
$totalCount == 0){
                                                echo 
"<b>no videos found - try again</b><br />";
                                                echo 
"<form action=\"".$_SERVER["PHP_SELF"]."\" method=\"POST\">";
                                                echo 
"enter your YomanSports user name <input type=\"text\" name=\"username\"><input type=\"Submit\" value=\"search for yomansports videos by this user\">";
                                                echo 
"</form>";
                                                exit;
                                            }
                                            else {
                                                if(
$page==1){
                                                    echo 
"Found a total of ".$array->sponsored_training_vdos["total"]." videos<br />";
                                                }
                                                echo 
"Page ".$page." of ".ceil($array->sponsored_training_vdos["total"]/$page_limit)."<br />";
                                                echo 
"<hr>";
                                                foreach (
$array->sponsored_training_vdos->sponsored_training_video as $sponsored_training_video){
                                                    echo 
"Title: <b>".$sponsored_training_video["title"]."</b><br />";
                                                
// display the thumbnail
                                                
echo "<img src=".$sponsored_training_video["img_src"]."><br clear=\"left\" />";
                                        
                                                
// original sponsored_training_video page url with link
                                                
echo "<a href=\"".$sponsored_training_video["ind_page_link"]."\">".$sponsored_training_video["ind_page_link"]."</a><br clear=\"left\" />";
                                                
                                                echo 
"Description: ".$sponsored_training_video["description"]."<br clear=\"left\" />";
                                                
                                                echo 
"Views: ".$sponsored_training_video["views"]."<br clear=\"left\" />";
                                                
                                                echo 
"keyword: ".$sponsored_training_video["keyword"]."<br clear=\"left\" />";
                                                
                                                echo 
"Add Date: ".$sponsored_training_video["add_date"]."<br clear=\"left\" />";
                                                
                                                echo 
"Added By: <a href=\"".$sponsored_training_video["profile_link"]."\">".$sponsored_training_video["username"]."</a><br clear=\"left\" />";
                                                
                                                
$params = array(
                                                          
"api_key"    => $api_key,
                                                          
"method"    => "yomansports.sponsored.training.video.comment.byVideoID",
                                                          
"username"    => $username,
                                                          
"training_vdo_id"        => $sponsored_training_video["VID"]
                                                      );
                                                      
                                                      
$encoded_params = array();
                                                      foreach (
$params as $k => $v){
                                                          
$encoded_params[] = urlencode($k)."=".urlencode($v);
                                                      }
                                                        
//$url = "http://api.yomansports.com/services/?".implode("&", $encoded_params);
                                                        
$url "http://www.yomansports.com/api/".implode("&"$encoded_params);
                                        
                                                        if(
function_exists("curl_init")){
                                                          
$detail=curl_init($url);
                                                          
curl_setopt($detailCURLOPT_HEADERfalse);
                                                          
curl_setopt($detailCURLOPT_RETURNTRANSFERtrue);
                                                          
$rsp_comment=curl_exec($detail);
                                                          
curl_close($detail);
                                                      } else {
                                                          
$rsp_comment file_get_contents($url);
                                                      }
                                                        
$array_comment simplexml_load_string($rsp_comment);
                                                        if(
$array_comment->comments["total"] == 0) {
                                                            echo 
"There are no comments for this video<br /><hr>";
                                                        }
                                                        else {
                                                            echo 
"<ul>";
                                                            foreach (
$array_comment->comments->comment as $comment){
                                                                echo 
"<li>[".$comment["username"]."] ".$comment["trv_comment"]."</li>";
                                                            }
                                                            echo 
"</ul><br /><hr>";
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    
                                    
?>
                                    
Error Codes
Error Code description
1: The API key passed was not valid or has expired.

2: User name is not valid.

3: The requested method was not found.
Top Videos
More
Top Pictures
More
Featured Training Videos