Forked from m4tlch/curl_dont_wait_for_response.php
Last active
July 20, 2023 05:32
-
-
Save alexllnk/53a9fa6f5461fca0d97aa0530b2c9ab6 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 | | |
| [email protected] | | |
| 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