PHPでURLをBitly短縮したい!

本ページはアフィリエイトプログラムによる収益を得ています。


と思ったので 探したら プラグインがあった

PHPからbit.lyやtr.im等のURL短縮サービスをまとめて扱える「PEAR::Services_ShortURL」:phpspot開発日誌

以下メモ
PEARであるならコマンド打ってインストールだ!とおもったら
#pear install Services_ShortURL
Failed to download pear/Services_ShortURL within preferred state “stable”, latest release is version 0.1.0, stability “alpha”, use “channel://pear.php.net/Services_ShortURL-0.1.0” to install
URLちゃんと指定しろばーか
といわてしまったので
#pear install channel://pear.php.net/Services_ShortURL-0.1.0
URL指定

pear/Services_ShortURL requires package “pear/HTTP_Request2”
pear/Services_ShortURL requires package “pear/Net_URL2” (version >= 0.2.0)
おまえこんなけ必要なパッケージねーぞといわれたので
順番に入れる
# pear install channel://pear.php.net/HTTP_Request2-0.5.1
pear/HTTP_Request2 requires PEAR Installer (version >= 1.5.4), installed version is 1.4.9
pear/HTTP_Request2 requires package “pear/Net_URL2” (version >= 0.2.0)
やっぱり怒られる・・・
PEARのバージョンが古いぞ!
Ner_URL2ないぞ!!
Pearの最新は1.9みたいですがとりあえず1.5.4を要求されてるのでそれを入れる
#pear upgrade -a PEAR-1.5.4
downloading PEAR-1.5.4.tgz …
Starting to download PEAR-1.5.4.tgz (293,070 bytes)
…………………………………………………….done: 293,070 bytes
downloading Archive_Tar-1.3.2.tgz …
Starting to download Archive_Tar-1.3.2.tgz (17,150 bytes)
…done: 17,150 bytes
downloading XML_RPC-1.5.2.tgz …
Starting to download XML_RPC-1.5.2.tgz (32,073 bytes)
…done: 32,073 bytes
upgrade ok: channel://pear.php.net/XML_RPC-1.5.2
upgrade ok: channel://pear.php.net/Archive_Tar-1.3.2
upgrade ok: channel://pear.php.net/PEAR-1.5.4
PEAR: Optional feature webinstaller available (PEAR’s web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR’s PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR’s PHP-GTK2-based installer)
To install use “pear install pear/PEAR#featurename”

おお無事入った。

# pear install channel://pear.php.net/Net_URL2-0.3.0
downloading Net_URL2-0.3.0.tgz …
Starting to download Net_URL2-0.3.0.tgz (8,371 bytes)
…..done: 8,371 bytes
install ok: channel://pear.php.net/Net_URL2-0.3.0
# pear install channel://pear.php.net/HTTP_Request2-0.5.1
downloading HTTP_Request2-0.5.1.tgz …
Starting to download HTTP_Request2-0.5.1.tgz (58,027 bytes)
…………..done: 58,027 bytes
install ok: channel://pear.php.net/HTTP_Request2-0.5.1
# pear install channel://pear.php.net/Services_ShortURL-0.1.0
downloading Services_ShortURL-0.1.0.tgz …
Starting to download Services_ShortURL-0.1.0.tgz (8,371 bytes)
…..done: 8,371 bytes
install ok: channel://pear.php.net/Services_ShortURL-0.1.0
なんか全部入った!
はじめのページにあるサンプルコードを適当にもってきて
動かない!!!
いったん挫折の巻・・・
うごかない

PEAR


おすすめ

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

コメントは承認待ちです。表示されるまでしばらく時間がかかるかもしれません。

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください