PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Carlos Miguel Guevara   Shorten url   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example of usage
Class: Shorten url
Shorten and expand URLs using different services
Author: By
Last change:
Date: 14 years ago
Size: 1,877 bytes
 

Contents

Class file image Download
<?php
include('shortenurl.class.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Short url example</title>
<style type="text/css">
ul{list-style:none; margin:0; padding:0;}
ul li{ background-color:#E5E5E5; border:1px solid#666; margin-bottom:10px; width:40%; padding:10px}
ul li:hover{background-color:#DDD}
ul li a{color:#F00; text-decoration:none; font-size:20px}
</style>
</head>

<body>
<form name="form1" method="post" action="">
  <p>
    <label>
     
      <input type="text" name="url" id="url" value="Here you url:">
    </label>
    <label>
      <input type="submit" name="btn_short" id="btn_short" value="Short my url">
    </label>
  </p>
  <?php if( isset($_POST['url'])){
       
$su = new Shortenurl($url);
       
$su->bitly_username = 'dejitaru' ;
       
$su->bitly_apikey = 'R_03e4d3e938d6286228e51a34cbf6257d';
       
$su->cligs_apiid = '12' ;
       
$su->cligs_apikey = '2481306c133ce75823bf4c7d166d9281';
        echo
$su->google();

 
?>
<ul>
    <li><b>Bit.ly</b> => <a href="<?php echo $su->bitly();?>"><?php echo $su->bitly();?></a></li>
    <li><b>Goo.gl</b> => <a href="<?php echo $su->google();?>"><?php echo $su->google();?></a></li>
    <li><b>Tinyurl.com</b> => <a href="<?php echo $su->tinyurl();?>"><?php echo $su->tinyurl();?></a></li>
    <li><b>Cli.gs</b> => <a href="<?php echo $su->cligs();?>"><?php echo $su->cligs();?></a></li>
    <li><b>Is.gd</b> => <a href="<?php echo $su->isgd();?>"><?php echo $su->isgd();?></a></li>
    <li><b>Kl.am</b> => <a href="<?php echo $su->klam();?>"><?php echo $su->klam();?></a></li>
    <li><b>Tr.im</b> => <a href="<?php echo $su->trim();?>"><?php echo $su->trim();?></a></li>
  </ul>
  <?php }?>
</form>
</body>
</html>