[go: up one dir, main page]

0% found this document useful (0 votes)
39 views4 pages

API Leadbit

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views4 pages

API Leadbit

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Setting up the API

For a landing page to work with an API, you need hosting with PHP support.
To set up an API, you need
The following information:
1) webmaster id (to find out the individual key, the individual key can be found in the
https://leadbit.com/api-doc/ in the "Requirements" block)
2) Flow

1. Pay attention to the comments in the code, they will help you insert the necessary
data correctly.

After that, in the landing page, in the file index.php on top, you need to insert the code
(here we change only the individual key, and if the path to the "thank you" page is
different, then change the Location)

<?php

if (!empty($_POST['phone'])) {
send_the_order ($_POST);
}

function send_the_order ($post){


$params=array(
'flow_hash' => $post['flow_hash'], // All data must be added only to the form
'landing' => $post['landing'], // All data must be added only to the form
'referrer' => $post['referrer'],
'phone' => $post['phone'],
'name' => $post['name'],
'country' => $post['country'], // All data must be added only to the form
'address' => $post['address'],
'email' => $post['email'],
'lastname' => $post['lastname'],
'comment' => $post['comment'],
'layer' => $post['layer'],
'ip' => $post['ip'],
'sub1' => $post['sub1'],
'sub2' => $post['sub2'],
'sub3' => $post['sub3'],
'sub4' => $post['sub4'],
'sub5' => $post['sub5'],
);
$url = 'http://wapi.leadbit.com/api/pub/new-order/_5fxxxxxxxxxxxxxxxxxxxx'; // Your
token without curly braces

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_REFERER, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
$return= curl_exec($ch);
curl_close($ch);
$array=json_decode($return, true);
header('Location: order.html'); // Link to the "Thank you" page
}
?>

2. Next, add the following code to each form


At the same time, change the fields:
● landing - in the name of the landing page,
● flow_hash - per stream
<input type="hidden" name="landing" value="es.erogannd.com"><!-- link to the landing
page in Leadbit without http://. Any landing page (not a pre-landing page) from the offer you
are working with will do --->
<input type="hidden" name="ip" value="<?=$_SERVER['REMOTE_ADDR']?
>">
<input type="hidden" name="createdAt" value="<?=date("Y-m-d H:i:s")?>">
<input type="hidden" name="userAgent" value="<?
=$_SERVER['HTTP_USER_AGENT']?>">
<input type="hidden" name="flow_hash" value="YSCk"> <!-- Your Stream -->
<input type="hidden" name="sub1" value="{subid}"> <!-- to transfer subs
(Keitaro)-->
<input type="hidden" name="sub2" value="">
<input type="hidden" name="sub3" value="">
<input type="hidden" name="sub4" value="">
<input type="hidden" name="sub5" value="">
<input type="hidden" name="referrer" value="<?
=$_SERVER['HTTP_REFERER']?>">

Also, the form must have the following fields (the country in this example is Italy)<select
name="country"><option value="it">Italia</option></select>
<input name="name">
<input name="phone">

You might also like