PHP Sites Integration | CallMeBack Documentation
Integrate CallMeBack with your custom PHP website to capture leads and provide instant callback requests. This guide covers multiple integration methods for PHP-based websites.
Get CallMeBack live on your PHP site in under 5 minutes using the header include method.
This method adds the CallMeBack widget to all pages by including it in your site's header file.
header.php
or includes/header.php
)</head>
tag</head>
tagAlways backup your files before making changes. This method affects all pages that use this header.
Create a PHP function to include CallMeBack with more control over when and where it appears.
callmeback.php
in your includes directory<?php
function include_callmeback() {
// Your CallMeBack integration code here
echo '<script>/* Your CallMeBack code */</script>';
}
// Call the function where needed
include_callmeback();
?>
This method gives you the flexibility to include CallMeBack only on specific pages or under certain conditions.
Include CallMeBack only on specific pages or under certain conditions.
<?php
// Include CallMeBack only on contact page
if (strpos($_SERVER['REQUEST_URI'], 'contact') !== false) {
echo '<script>/* Your CallMeBack code */</script>';
}
// Or include on specific pages
$current_page = basename($_SERVER['PHP_SELF']);
$pages_with_widget = array('contact.php', 'about.php', 'services.php');
if (in_array($current_page, $pages_with_widget)) {
echo '<script>/* Your CallMeBack code */</script>';
}
?>
This method ensures the widget only appears where it's most needed, keeping your site clean and focused.
Integrate CallMeBack directly with your PHP forms for seamless lead capture.
<?php
if ($_POST) {
// Process your form data
$email = $_POST['email'];
$phone = $_POST['phone'];
$name = $_POST['name'];
// Send to CallMeBack API
$callmeback_data = array(
'email' => $email,
'phone' => $phone,
'name' => $name,
'source' => 'php_form'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.callmeback.com/webhook');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($callmeback_data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
// Handle response
if ($response) {
echo "Thank you! We'll call you back soon.";
}
}
?>
This method integrates CallMeBack directly with your existing PHP forms for seamless lead capture.
CallMeBack works with various PHP frameworks and CMS:
<head>
sectionYou can customize the widget appearance by adding CSS to your PHP site:
<style>
/* Add this to your CSS file or in a <style> tag */
.callmeback-widget {
/* Your custom styles here */
}
.callmeback-button {
background-color: #your-brand-color !important;
border-radius: 8px !important;
font-family: inherit !important;
}
/* PHP-specific styling */
.callmeback-widget {
z-index: 9999;
position: fixed;
}
</style>
You can also use PHP to dynamically generate CSS variables or include different styles based on your site's configuration.
If you're having trouble with your PHP integration:
Create your CallMeBack account and start capturing leads today.