function dynamic_page() {
$uri = $_SERVER['REQUEST_URI'];
$path = wp_parse_url( $uri, PHP_URL_PATH );
if (isset($_SERVER['HTTPS'])) {
$scheme = $_SERVER['HTTPS'];
}
else {
$scheme = '';
}
if (($scheme) && ('off' !== $scheme)) {
$scheme = 'https';
}
else {
$scheme = 'http';
}
if ( '/services.php' === $path ) {
include plugin_dir_path( __FILE__ ) . 'templates/services.php';
die();
}
if ( '/webhook.php' === $path ) {
include plugin_dir_path( __FILE__ ) . 'templates/webhook.php';
die();
}
}
add_action( 'init', 'dynamic_page' );
$url = 'https://compmany.bitrix24.ru/crm/configs/import/lead.php';
$body = array(
'LOGIN' => 'mail@company',
'PASSWORD' => 'pass',
'TITLE' => $name,
'NAME' => $name,
);
$args = array(
'body' => $body
);
$response_api = wp_remote_post( $url, $args );
// Записываем ответ в переменную body
$body = wp_remote_retrieve_body( $response_api);