<?php
function getCreditMember($userid) {
	$ch = curl_init();
	#curl_setopt($ch, CURLOPT_HEADER, 1);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_COOKIEJAR, dirname( __FILE__ )."/cookie");
	curl_setopt($ch, CURLOPT_COOKIEFILE, dirname( __FILE__ )."/cookiejar");
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
	curl_setopt($ch, CURLOPT_VERBOSE, 1);
	#curl_setopt($ch, CURLOPT_HEADER, 1);
	$cookies = array();
	foreach ($_COOKIE as $key => $value) {
		if ($key != 'Array') {
			$cookies[] = $key . '=' . $value;
		}
	}
	curl_setopt($ch, CURLOPT_COOKIE, implode(';', $cookies));
	curl_setopt($ch, CURLOPT_URL, "http://cp.charycannia.com/new.index.php?userid=$userid");
	$info = curl_exec($ch);
	$parse = explode('<body>', $info);
	$parse = explode('</body>', $parse[1]);
	$ddd = trim($parse[0]);
	#echo'<xmp>';printR($ddd);echo'</xmp>';
	#var_dump(json_decode($ddd, true));
	$hasil = json_decode(trim($ddd), true);
	return $hasil;
}
function getCreditMemberAll() {
	$ch = curl_init();
	#curl_setopt($ch, CURLOPT_HEADER, 1);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_COOKIEJAR, dirname( __FILE__ )."/cookie");
	curl_setopt($ch, CURLOPT_COOKIEFILE, dirname( __FILE__ )."/cookiejar");
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
	curl_setopt($ch, CURLOPT_VERBOSE, 1);
	#curl_setopt($ch, CURLOPT_HEADER, 1);
	$cookies = array();
	foreach ($_COOKIE as $key => $value) {
		if ($key != 'Array') {
			$cookies[] = $key . '=' . $value;
		}
	}
	curl_setopt($ch, CURLOPT_COOKIE, implode(';', $cookies));
	curl_setopt($ch, CURLOPT_URL, "http://cp.charycannia.com/new.index.php");
	curl_setopt($ch, CURLOPT_URL, "http://cp.charycannia.com/");
	$info = curl_exec($ch);
	$parse = explode('<body>', $info);
	$parse = explode('</body>', $parse[1]);
	$ddd = trim($parse[0]);
	#return $ddd;
	#exit;
	#echo'<xmp>';printR($ddd);echo'</xmp>';
	#var_dump(json_decode($ddd, true));
	$hasil = json_decode(trim($ddd), true);
	return $hasil;
}
?>