goo.gl short URL API 사용 > php

본문 바로가기
사이트 내 전체검색

php

goo.gl short URL API 사용

페이지 정보

작성자 서방님 댓글 0건 조회 149회 작성일 12-11-14 11:22

본문

구글 사이트를 참조합니다.
http://code.google.com/apis/urlshortener/v1/reference.html#method_urlshortener_url_insert  

2011년 3월 기준 위 링크의 API 를 참조했습니다.

function googl_short_url($long_url) {
//  global $googl_login, $googl_api_key;
    $googl_api_key = "API키값";
    $googl_url = "https://www.googleapis.com/urlshortener/v1/url";
    $post_url = $googl_url . "?key=" . $googl_api_key;
    $post_data = "{\"longUrl\": \"".$long_url."\"}";

    $response = file_post_contents_curl($post_url, $post_data)undefined;
    $obj = json_decode($response);
    $short_url = $obj->{'id'};

    return $short_url;


$long_url 값, 즉 URL 주소를 입력하면 ( 예) http://www.google.co.kr/intl/ko/about.html),
"http://goo.gl/tuaw2" 가 $short_url 이 됩니다.

댓글목록

등록된 댓글이 없습니다.

Total 614건 31 페이지
php 목록
번호 제목 글쓴이 조회 날짜
164 서방님 118 11-14
163 서방님 148 11-14
열람중 서방님 150 11-14
161 서방님 97 11-07
160 서방님 156 11-07
159
php pdf 출력 댓글+ 1
서방님 363 11-06
158 서방님 125 11-06
157 서방님 152 10-31
156 서방님 185 10-30
155 서방님 107 10-30
154 서방님 130 10-30
153 서방님 671 10-29
152 서방님 0 10-29
151 서방님 235 10-25
150 서방님 134 10-24
게시물 검색

회원로그인

접속자집계

오늘
106
어제
190
최대
1,347
전체
167,514
Latest Crypto Fear & Greed Index

그누보드5
Copyright © 서방님.kr All rights reserved.