Last active
July 3, 2019 13:58
-
-
Save m4tlch/e5e5c219f59e7f0e5606aa7c5658df50 to your computer and use it in GitHub Desktop.
Curl without waiting response
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
<?php | |
///amo integra begin | |
$values = $hook->getValues(); | |
$subject = $modx->getOption('emailSubject', $formit->config, 'form-'.$modx->resource->get('emailSubject')); | |
$name = $values['name']; | |
$phone = $values['phone']; | |
$email = $values['email']; | |
$text = isset($values['text'])?$values['text']:''; | |
$ch = curl_init('https://site.com/amo/create.php'); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_TIMEOUT_MS, 10); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, array( | |
'token' => 'b90d5283b0db0621cef1f920464b48b1', | |
"name" =>$name, | |
"contact*#*name" => $name, | |
'contact*#*phone' => $phone, | |
'contact*#*email' => $email, | |
'Комментарий_формы'=> $text, | |
'Форма_с_сайта' => $subject, | |
'Url_сайта' => 'https://www.dietolog4you.com/', | |
)); | |
curl_exec($ch); | |
curl_close($ch); | |
///amo integra end | |
?> | |
//https://site.com/amo/create.php | |
<? | |
<?php | |
ignore_user_abort(true); | |
set_time_limit(0); | |
ob_start(); | |
header($_SERVER["SERVER_PROTOCOL"] . " 202 Accepted"); | |
header("Status: 202 Accepted"); | |
//header('Connection: close'); | |
header('Content-Length: '.ob_get_length()); | |
ob_end_flush(); | |
ob_flush(); | |
flush(); | |
/* __________________________________________________ | |
| Created by NikaCRM - SAI | | |
| support@nikacrm.com | | |
| https://nikacrm.com | | |
| All rights reserved | | |
|__________________________________________________| | |
*/ | |
require 'vendor/autoload.php'; | |
use Nikacrm\Amo; | |
use Nikacrm\Config; | |
use Nikacrm\Request; | |
$config = new Config('config.php'); | |
$request = new Request($config); | |
$data = $request->getData(); | |
$amo = new Amo($data, $config); | |
$amo->createEntities(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment