La API de Google para acortar URLs permite acortar URLs, recuperar info del link original y las URLs acortadas de un usuario, aunque para usarlo se necesita crear una clave y dar de alta proyecto.
El resto es fácil, acceso mediante CURL y listo:
define('GOOGLE_API_KEY', '[insert your key here]');
define('GOOGLE_ENDPOINT', 'https://www.googleapis.com/urlshortener/v1');
function shortenUrl($longUrl)
{
// initialize the cURL connection
$ch = curl_init(
sprintf('%s/url?key=%s', GOOGLE_ENDPOINT, GOOGLE_API_KEY)
);
// tell cURL to return the data rather than outputting it
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// create the data to be encoded into JSON
$requestData = array(
'longUrl' => $longUrl
);
// change the request type to POST
curl_setopt($ch, CURLOPT_POST, true);
// set the form content type for JSON data
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
// set the post body to encoded JSON data
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($requestData));
// perform the request
$result = curl_exec($ch);
curl_close($ch);
// decode and return the JSON response
return json_decode($result, true);
}
$response = shortenUrl('http://phpriot.com');
echo sprintf(
'%s was shortened to %s',
$response['longUrl'],
$response['id']
);
Shortening URLs for goo.gl with Google’s URL Shortener API
Vía / PHPDeveloper.org
Yo he usado Wildfire (la versión previa de Openfire) para dar soporte a mensajerÃa interna de una empresa con 200/300 usuarios. Además se que la última versión de Openfire está por implementarse en otra empresa para mensajerÃa interna con casi 1000 usuarios y, usando un plugin, también dar soporte a un webchat en el callcenter de dicha empresa.
Gracias, Martin, por lo que dices parece que el rendimiento de Openfire va bien, a mi me han hablado un poco mal de él, por ser Java, aunque yo he trabajado mucho en Java y no he tenido problemas
Saludos
Openfire no está mal. Muy sencillo de instalar y configurar. Una interfaz web bastante completa y muchos plugins, para las pasarelas, webchat, bla bla… Lo malo es que es puro Java y consume demasiados recursos!