File: D:/HostingSpaces/SBogers10/topswtw.komma.pro/app/KommaApp/Shop/Modules/Kiyoh/KiyohMailConnector.php
<?php
namespace KommaApp\Shop\Modules\Kiyoh;
class KiyohMailConnector
{
protected $action = 'sendInvitation'; // Action
protected $delay = '3'; // Days of delay
public function callUrl($customerEmail)
{
return false;
$shopSlug = \Shop::getShop()->slug;
$connectorCode = \Config::get('komma/kiyoh.' . $shopSlug . '.connector');
$user = \Config::get('komma/kiyoh.' . $shopSlug . '.user');
$url = 'http://www.kiyoh.nl/set.php?';
$url .= 'user=' . $user . '&';
$url .= 'connector=' . $connectorCode . '&';
$url .= 'action=' . $this->action . '&';
$url .= 'targetMail=' . $customerEmail . '&';
$url .= 'delay=' . $this->delay . '';
$ch = curl_init();
$options = [
CURLOPT_URL => $url,
// TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it out directly.
CURLOPT_RETURNTRANSFER => true,
// TRUE to include the header in the output.
CURLOPT_HEADER => false,
// TRUE to follow any "Location: " header that the server sends as part of the HTTP header.
CURLOPT_FOLLOWLOCATION => true,
// If an empty string, "", is set, a header containing all supported encoding types is sent.
CURLOPT_ENCODING => "",
// TRUE to automatically set the Referer: field in requests where it follows a Location: redirect.
CURLOPT_AUTOREFERER => true,
// The number of seconds to wait while trying to connect.
CURLOPT_CONNECTTIMEOUT => 120,
// The maximum number of seconds to allow cURL functions to execute.
CURLOPT_TIMEOUT => 120,
// The maximum amount of HTTP redirections to follow. Use this option alongside CURLOPT_FOLLOWLOCATION.
CURLOPT_MAXREDIRS => 10,
// Doesn't work with verification, so add these two parameters
CURLOPT_SSL_VERIFYPEER => false,
// Authenticating the certificate is not enough to be sure about the server. You typically also
// want to ensure that the server is the server you mean to be talking to. Use CURLOPT_SSL_VERIFYHOST
// for that. The check that the host name in the certificate is valid for the host name you're connecting
// to is done independently of the CURLOPT_SSL_VERIFYPEER option.
CURLOPT_SSL_VERIFYHOST => false,
];
// Set options
curl_setopt_array( $ch, $options );
// Response
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
// Close curl
curl_close($ch);
return [$httpCode, trim($response), $error];
}
}