URL Shortener main page

 

CHOGOON URL SHORTENER API

 


1. API Basic Information
- Request URL: https://chogoon.com/srt/api/
- Request Method: POST
- Output format: JSON
- Request parameter: url - required

2. Results
- status_code: http status code ( success: 200 )
- data( array ): result data

data:
- resultCode: Result code ( success: 01, No URL entered.: 02 )
- resultMsg: Result message
- orgUrl: source URL
- url: shortened URL
- qrCodeBase64: qr code image encoded base64 (PNG)



* Url Shortening for tweetbot ( https://tapbots.com/tweetbot/ ):
 - https://chogoon.com/srt/twt/?url=%@
					

 

[PHP CODE Example]

<?
$url = "https://chogoon.com/srt/api/";

// URL information to shorten
$postParam = array('url' => "http://newbc.kr/bbs/board.php?bo_table=notice&wr_id=836");

function curl_post($url, $postParam) {
	$ch = curl_init($url);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
	curl_setopt($ch, CURLOPT_FAILONERROR, 1);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
	curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
	curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postParam));
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_TIMEOUT, 50);

	$result = curl_exec($ch);
	$curl_errno = curl_errno($ch);
	$curl_error = curl_error($ch);
	if($curl_errno > 0) {
		$result = "cURL Error ($curl_errno): $curl_error\n";
	}
	curl_close($ch);

	return $result;
}

$ret = curl_post($url, $postParam);

$retArr = json_decode($ret, true);

// Result
print_r($retArr);
?>

					

 

Copyright © 2017-2018 CHOGOON All rights Reserved