craig88
Member
Hi Guys,
I'm trying to do an API intergration so that my webpage sends a customers details directly to the network so they can then follow up with the order. But I'm struggling with PHP code not being correct.
This is the help URL which they have provided: Incoming orders API - AdCombo Docs - AdCombo Confluence
This is my PHP code
any idea what is wrong?
<!DOCTYPE html>
<html lang="en">
<body>
<?php
const API_URL = "https://api.adcombo.com/api/v2/order/create/";
const API_KEY = "123456789";
$isCurlEnabled = function(){
return function_exists('curl_version');
};
if (!$isCurlEnabled) {
echo "<pre>";
echo "pls install curl\n";
echo "For *unix open terminal and type this:\n";
echo 'sudo apt-get install curl && apt-get install php-curl';
die;
}
$args = [
'api_key' => '123456789',
'name' = $_GET['personsname']; ,
'phone' = $_GET['phonenumber']; ,
'offer_id' => '11111',
'country_code' => $_GET['country_code_selector']; ,
'price' => 60,
'base_url' => 'my-domain.com - This website is for sale! - my-domain Resources and Information.' ,
'ip' => 'INSERT CLIENTS IP ADDRESS',
'referrer' => 'http://my-click-site.com',
'subacc' => 'INSERT SUBACCOUNT 1',
'subacc2' => 'INSERT SUBACCOUNT 2',
'subacc3' => 'INSERT SUBACCOUNT 3',
'subacc4' => 'INSERT SUBACCOUNT 4',
'utm_campaign' => 'INSERT utm_campaign',
'utm_content' => 'INSERT utm_content',
'utm_medium' => 'INSERT utm_medium',
'utm_source' => 'INSERT utm_source',
'utm_term' => 'INSERT utm_term',
// you can add any extra field to get it in postback
'clickid' => 'INSERT YOUR CLICK ID',
];
$url = API_URL.'?'.http_build_query($args);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true
));
$res = curl_exec($curl);
curl_close($curl);
$res = json_decode($res, true);
if ($res['code'] == 'ok') {
echo $res['msg'] . ": " . $res['order_id'];
} else {
echo $res['error'];
}
?>
</body>
</html>
I'm trying to do an API intergration so that my webpage sends a customers details directly to the network so they can then follow up with the order. But I'm struggling with PHP code not being correct.
This is the help URL which they have provided: Incoming orders API - AdCombo Docs - AdCombo Confluence
This is my PHP code
any idea what is wrong?
<!DOCTYPE html>
<html lang="en">
<body>
<?php
const API_URL = "https://api.adcombo.com/api/v2/order/create/";
const API_KEY = "123456789";
$isCurlEnabled = function(){
return function_exists('curl_version');
};
if (!$isCurlEnabled) {
echo "<pre>";
echo "pls install curl\n";
echo "For *unix open terminal and type this:\n";
echo 'sudo apt-get install curl && apt-get install php-curl';
die;
}
$args = [
'api_key' => '123456789',
'name' = $_GET['personsname']; ,
'phone' = $_GET['phonenumber']; ,
'offer_id' => '11111',
'country_code' => $_GET['country_code_selector']; ,
'price' => 60,
'base_url' => 'my-domain.com - This website is for sale! - my-domain Resources and Information.' ,
'ip' => 'INSERT CLIENTS IP ADDRESS',
'referrer' => 'http://my-click-site.com',
'subacc' => 'INSERT SUBACCOUNT 1',
'subacc2' => 'INSERT SUBACCOUNT 2',
'subacc3' => 'INSERT SUBACCOUNT 3',
'subacc4' => 'INSERT SUBACCOUNT 4',
'utm_campaign' => 'INSERT utm_campaign',
'utm_content' => 'INSERT utm_content',
'utm_medium' => 'INSERT utm_medium',
'utm_source' => 'INSERT utm_source',
'utm_term' => 'INSERT utm_term',
// you can add any extra field to get it in postback
'clickid' => 'INSERT YOUR CLICK ID',
];
$url = API_URL.'?'.http_build_query($args);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true
));
$res = curl_exec($curl);
curl_close($curl);
$res = json_decode($res, true);
if ($res['code'] == 'ok') {
echo $res['msg'] . ": " . $res['order_id'];
} else {
echo $res['error'];
}
?>
</body>
</html>