API Leadbit
API Leadbit
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);
}
$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
}
?>
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">