martyix/googl-php

sebi/googl-php 的分支。

v1.0.2 2014-08-12 14:28 UTC

This package is not auto-updated.

Last update: 2024-09-24 07:36:46 UTC


README

简介

googl-php 是一个小型、简单的 PHP 类,旨在与 Google URL 缩短服务 "Goo.gl" 一起使用,并受 GNU GPL v3 许可协议的约束。

功能

当前该类支持 2 个方法:

  • 缩短 URL
  • 展开(查找)已缩短的 URL

使用方法

<?php 

require_once('Googl.class.php');

$googl = new Googl('YOUR_API_KEY');

// Shorten URL
$googl->shorten('http://www.google.com/');

// Look up long URL
$googl->expand('http://goo.gl/fbsS');

unset($googl);

API 密钥

使用该类(即缩短服务)不需要 API 密钥。

但是,正如 Google 在自己的 "入门指南" 中所写,使用一个 "强烈推荐"。点击按钮并不会真的有什么坏处,对吧?

更多信息

有关 Goo.gl 和其 API 的更多信息,请访问:https://developers.google.com/url-shortener/