ABOUT
We have created an easy to use copy and paste class to get you started integrating ity.im into your php application.
ITYIM PHP CLASS EXAMPLE CODE
We have created a simple wrapper class in PHP for using the ity.im API. Integration into your website is fast and easy.
Download the class:
Example usage (intialize class):
//include class file------------
include_once("ityclass.php");
Buy social marketing.
//initialize class--------------
$ityclass=new ityim();
$ityclass->login="apidemo@ity.im"; //your ity.im login email address
$ityclass->apikey="2147483647"; //your ity.im api key
$ityclass->format="xml"; //output format; json or xml
//------------------------------
Example usage (shrink a url):
$ityclass->longurl="http://sometestsite.com/?testing12354"; //provide a long url to be shortened
$ityclass->disable_inter="1"; // 0 to disable interstitial ads, 1 to enable ads.
$ityclass->shrinkurl(); //controller function
//Returned Accessable Object--------------- // $ityclass->returned->status_code - the status code // $ityclass->returned->status_txt - status description // $ityclass->returned->data->url - complete shortened url // $ityclass->returned->data->hash - hash only // $ityclass->returned->data->long_url - the long url submitted
Example usage (expand a url & get click stats):
//expand a url or hash includes click stats******************
$ityclass->shorturl="http://ity.im/09K"; //provide a short url to be expanded (seperated by commas for multiples) $ityclass->hash="00y,00U"; // hash only (seperated by commas for multiples) $ityclass->format="json"; //output format; json or xml $ityclass->expand(); //controller function //NOTE: to include multiple hash or shorturl's add them as a string seperated by commas. //example: $ityclass->hash="F4s3a,4Fsfg,85fDs,Cvse4";
//Returned Object---------------
// $ityclass->returned->status_code - the status code
// $ityclass->returned->status_txt - status description
// $ityclass->returned->data->expand[0]->long_url - long url assigned to hash
// $ityclass->returned->data->expand[0]->hash - hash only
// $ityclass->returned->data->expand[0]->short_url - short url
// $ityclass->returned->data->expand[0]->clicks_today - clicks today
// $ityclass->returned->data->expand[0]->clicks_month - clicks this month
// $ityclass->returned->data->expand[0]->clicks_overall - clicks overall
//------------------------------
//NOTE: if multiple hash's or short urls were submitted the returned data object will be an array with multiple rows. A single row returned will
//be on row [0] of the array.
//***********************************************************
$ityclass->shorturl="http://ity.im/09K"; //provide a short url to be expanded (seperated by commas for multiples) $ityclass->hash="00y,00U"; // hash only (seperated by commas for multiples) $ityclass->format="json"; //output format; json or xml $ityclass->expand(); //controller function //NOTE: to include multiple hash or shorturl's add them as a string seperated by commas. //example: $ityclass->hash="F4s3a,4Fsfg,85fDs,Cvse4";
print_r($ityclass->returned) output:
stdClass Object
(
[status_code] => 200
[status_txt] => OK
[data] => stdClass Object
(
[expand] => Array
(
[0] => stdClass Object
(
[short_url] => http://ity.im/00y
[hash] => 00y
[long_url] => http://www.majon.com/blog-marketing-promotion.html
[clicks_today] => 0
[clicks_month] => 0
[clicks_overall] => 37
)
[1] => stdClass Object
(
[short_url] => http://ity.im/00U
[hash] => 00U
[long_url] => http://www.majon.com/safeannounce/
[clicks_today] =>
[clicks_month] =>
[clicks_overall] =>
)
[2] => stdClass Object
(
[short_url] => http://ity.im/09K
[hash] => 09K
[long_url] => http://test
[clicks_today] =>
[clicks_month] =>
[clicks_overall] =>
)
)
)
)
(
[status_code] => 200
[status_txt] => OK
[data] => stdClass Object
(
[expand] => Array
(
[0] => stdClass Object
(
[short_url] => http://ity.im/00y
[hash] => 00y
[long_url] => http://www.majon.com/blog-marketing-promotion.html
[clicks_today] => 0
[clicks_month] => 0
[clicks_overall] => 37
)
[1] => stdClass Object
(
[short_url] => http://ity.im/00U
[hash] => 00U
[long_url] => http://www.majon.com/safeannounce/
[clicks_today] =>
[clicks_month] =>
[clicks_overall] =>
)
[2] => stdClass Object
(
[short_url] => http://ity.im/09K
[hash] => 09K
[long_url] => http://test
[clicks_today] =>
[clicks_month] =>
[clicks_overall] =>
)
)
)
)
SEM web promotion package compares to other 20k SEO packages! Low cost!
Drive More Targeted Traffic Direct to Your Web Site. Real Traffic - Real Customers!
Get started advertising your business in our ad network now!
Written by on 8.1.2010
How To Get More Facebook Fans
Targeted Website Traffic
Banner Advertising on the Webs Fastest Growing Network
Targeted Email Advertising Works










