You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.7 KiB
57 lines
1.7 KiB
<?php
|
|
header("content-type: application/javascript");
|
|
error_reporting(0);
|
|
define('WMID', 10568);
|
|
define('HOST', 'https://api.cloudleadia.com/');
|
|
|
|
// send lead
|
|
if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
|
$postdata = http_build_query($_POST);
|
|
|
|
$opts = array('http' =>
|
|
array(
|
|
'method' => 'POST',
|
|
'header' => 'Content-type: application/x-www-form-urlencoded',
|
|
'content' => $postdata
|
|
)
|
|
);
|
|
$context = stream_context_create($opts);
|
|
$result = file_get_contents(HOST . 'lead', false, $context);
|
|
die();
|
|
}
|
|
|
|
$response = array(
|
|
'status' => 'reject',
|
|
'message' => ''
|
|
);
|
|
|
|
// get widget
|
|
$query = "wnew.js?wc=leadia/default/blade&w=" . WMID . "&p=lawyer&guest=1";
|
|
if (!empty($_GET)) {
|
|
$query .= '&' . http_build_query($_GET, '', '&');
|
|
}
|
|
|
|
$referer = '//' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
|
|
$opts = array(
|
|
'http'=>array(
|
|
'method'=>"GET",
|
|
'header'=>"Referer: " . $referer . "\r\n",
|
|
'user_agent'=>$_SERVER['HTTP_USER_AGENT']
|
|
)
|
|
);
|
|
$context = stream_context_create($opts);
|
|
|
|
try {
|
|
$file = file_get_contents(HOST . $query, false, $context);
|
|
if ($file === false) {
|
|
$error = error_get_last();
|
|
$response['message'] = "HTTP request failed. Error was: " . $error['message'];
|
|
die (json_encode($response));
|
|
} else {
|
|
echo $file;
|
|
}
|
|
} catch (Exception $e) {
|
|
$response['message'] = 'CATCH: ' . $e->getMessage();
|
|
die (json_encode($response));
|
|
}
|
|
?>
|
|
|