Contenu connexe
Similaire à Manipuler avec attention les URLs courtes (20)
Plus de Christophe Villeneuve (20)
Manipuler avec attention les URLs courtes
- 2. ???
http://bit.ly/TugThb
http://afup.org/pages/phptournantes2012/sessions.php
- 5. Fabriquer vos URLs courtes
● TinyURL – 11 caractères
● Bit.ly – 6 caractères
● g.co (Google) – 4 caractères
● fb.me (Facebook)
● t.co (Twitter)
http://votre_url/xxxxxx Calcul...
- 6. Exemple tiny_url
function get_tiny_url($url)
{
$ch = curl_init();
$timeout = 5;
curl_setopt($ch,CURLOPT_URL,'http://tinyurl.com/apicreate.php?url='.$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
- 7. MySQL PHP
Formulaire
● Id
url_longue
Requete $sql
●
● url_courte
● Compteur
Insert into 'votre_table'
● Date creation
● url_longue
● Date acces
● date_creation
- 8. En HTML
<link rel="shortlink" href="http://bit.ly/TugThb" />
http://afup.org/pages/phptournantes2012/sessions.php
- 10. Risques
● Phishing
● XSS
● Failles navigateurs
● SPAM
● Repère associé (1.usa.gov)
- 14. Solution
● Xpnd.it! (addon Firefox)
● View Thru (addon Chrome)
● Offre pro bit.ly (ex nyti.ms => NewYork TImes)
● ...