How to Generate Linkbucks link using curl?

Status
Not open for further replies.

dewaforex

Active Member
120
2011
17
0
Can anyone teach/share how to create linkbucks links using curl? It can be bash or php script.

Because linkbuks don't have the API so very difficult to me to create it unless using curl.

Thanks
 
6 comments
PHP:
<?php
//linkbucks converter by m1rr0z

function curl($url,$cookies,$post){
    $ch = @curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    if ($cookies) curl_setopt($ch, CURLOPT_COOKIE, $cookies);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    if ($post){
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    }
    curl_setopt($ch, CURLOPT_TIMEOUT, 25);
    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 25);
    $page = curl_exec( $ch);
    curl_close($ch);
    return $page;
}

######### linkbucks unlock
function linkbucks($lien)
{
if (preg_match('#(linkbucks)#', $lien, $lien0))
 {
$lienpre = curl($lien,'','');
if (preg_match("#Lbjs.TargetUrl = '(.*)';#", $lienpre, $url))
   {
   $linkgo = $url[1];
   }
 }
return  $linkgo;
}
#########

$linkbucks_link = ''; //your linkbucks link here
$converted_link = linkbucks($linkbucks_link);
echo $converted_link;

?>
 
Thank you for fast response :D
But your script is for unlock the linkbucks links :D
I need the opposite.

I need to create some of mediafire and jumbofiles links to be linkbucks link.
Only adf.ly that have API but my visitor is from Asia so adf.ly is not my choice as 90% will not show the ads.
 
Here's request body that you need to send
Code:
//Json body
{"OrigLink":"http://www.yourlinkHere","AdTypeID":"2","ContentTypeID":"1","LinkTypeID":1,"LinkGroupID":0,"exclusionsList":"","TargetOptionID":0,"LinkAliasID":"1","FrequencyCap":0}
Are you need a full working script ?
 
Here's request body that you need to send
Code:
//Json body
{"OrigLink":"http://www.yourlinkHere","AdTypeID":"2","ContentTypeID":"1","LinkTypeID":1,"LinkGroupID":0,"exclusionsList":"","TargetOptionID":0,"LinkAliasID":"1","FrequencyCap":0}
Are you need a full working script ?

Could you send the full script to me too please?
 
here's full script that I made for php with curl module:
Code:
<?php 
class LinkbucksGenerator 
{
	public function __construct($username, $password) 
	{
		$res = $this->sendRequest('http://www.***************',
			'__VIEWSTATE=%2FwEPDwUKMTgyODE4OTcxNA9kFgJmD2QWAgIBDxYCHgZhY3Rpb24FAS8WAgIDDxYCHgdWaXNpYmxlZ2QYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgEFI2N0bDAwJExlZnRNZW51QmFyJGN0bDAwJExvZ2luSW1nQnRuS8hakOPTjCRlsWTaAs%2Bzra8AOq62iJvb2b1%2BaYjQ3bA%3D&__EVENTVALIDATION=%2FwEWBAL%2Bzvj%2BBQK7qsuzDQL4%2Fd%2FXBwKsntP%2FCzjrmm0uzhVnRRESgrufVC4zwhIpeKxQ1DE28b0Xa30%2B&ctl00%24LeftMenuBar%24ctl00%24Username=' . $username . '&ctl00%24LeftMenuBar%24ctl00%24Password=' . $password . '&ctl00%24LeftMenuBar%24ctl00%24LoginImgBtn.x=73&ctl00%24LeftMenuBar%24ctl00%24LoginImgBtn.y=17');
		if( (!preg_match('/Object moved to <a href="\/default\.aspx">here<\/a>/', $res))) 
		{
			if((!preg_match('/Logged in as: <strong>' . $username . '<\/strong>/', $res)))
			{
				die('Invalid login credentials');
			}
		}
	}

	public function generateLink($url, $adTypeID = 2) 
	{
		$res = $this->sendRequest('http://www.***************ajaxpro/LinkGenLib,Linkbucks.ashx',
			'{"OrigLink":"'. $url .'","AdTypeID":"'. $adTypeID .'","ContentTypeID":"1","LinkTypeID":1,"LinkGroupID":0,"exclusionsList":"","TargetOptionID":0,"LinkAliasID":"1","FrequencyCap":0}', 1);
		if(preg_match('/"NewLink":"(.*?)"/', $res, $m)) 
		{
			return $m[1];
		}
		else 
		{
			return $res;
		}
	}

	private function sendRequest($url, $post, $type = 0) 
	{                                                                         
		$ch = curl_init();
		if($type == 1) 
		{

			curl_setopt($ch, CURLOPT_HTTPHEADER, array(
			    'X-AjaxPro-Method: SingleLinkParse',
			    'Content-Type: application/json',                                                                                
    			'Content-Length: ' . strlen($post)    
    		));
		}
		curl_setopt($ch, CURLOPT_COOKIEJAR, 'tmp/cookies');
		curl_setopt($ch, CURLOPT_COOKIEFILE, 'tmp/cookies');
		curl_setopt($ch,CURLOPT_URL, $url);
		curl_setopt($ch,CURLOPT_POST, count($post));
		curl_setopt($ch,CURLOPT_POSTFIELDS, $post);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
		$result = curl_exec($ch);
		curl_close($ch);
		return $result;
	}
}

$linkGenerator = new LinkbucksGenerator('linkbucksusername', 'linkbuckspassword');
$result = $linkGenerator->generateLink('url to convert');
echo $result; // outputs your link
?>
or
Code:
http://www21.zippyshare.com/v/33282435/file.html
 
Status
Not open for further replies.
Back
Top