짧은 주소 bit.ly api 사용 어떻게 해요?? 채택완료
존재하는
9년 전
조회 4,616
이전 자료 검색해 보니
이렇든데... 안되네요!!
어떤곳 수정 하면 되나요 ??
</p><p><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><? </span><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 </span><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"> </span><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">$bo_url = "$trackback_url"; </span><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">$shorturl = getSmallLink($bo_url); </span><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">//짧은 주소($shorturl); </span><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">function getSmallLink($longurl){ </span><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">// Bit.ly </span><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">$key_url = </span><a href="<a href="http://api.bit.ly/shorten?version=2.0.1&longUrl=" target="_blank" rel="noopener noreferrer">http://api.bit.ly/shorten?version=2.0.1&longUrl=</a>" target="_blank" style="text-decoration: none; color: rgb(63, 67, 71); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><a href="http://api.bit.ly/shorten?version=2.0.1&longUrl=" target="_blank" rel="noopener noreferrer">http://api.bit.ly/shorten?version=2.0.1&longUrl=</a></a><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">$longurl&login=발급받은 아이디&apiKey=발급받은 키&format=json&history=1; </span><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">$s = curl_init(); </span><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">curl_setopt($s,CURLOPT_URL, $key_url); </span><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">curl_setopt($s,CURLOPT_</span><span style="font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; color: red; background-color: yellow;">HEA</span><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">DER,false); </span><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">curl_setopt($s,CURLOPT_RETURNTRANSFER,1); </span><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">$result = curl_exec($s); </span><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">curl_close( $s ); </span><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">$obj = json_decode($result, true); </span><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">return $obj["results"]["$longurl"]["shortUrl"]; </span><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">} </span><br style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);"><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">?> </span> </p><p><span style="color: rgb(34, 34, 34); font-family: NanumGothicWeb, 나눔고딕, Verdana, Tahoma; font-size: 12px; line-height: 18px; background-color: rgb(255, 255, 255);">
댓글을 작성하려면 로그인이 필요합니다.
답변 2개
답변을 작성하려면 로그인이 필요합니다.
로그인