I have one plugin which you install on wp site and then need to connect it with my production site. For this connection I use CURL request.
I have problem with one wordpress site installed on wpengine. It worked fine for a long time and then suddenly CURL
is unable to connect with my production site from this wp site on wpengine.
In curl_error($ch)
I am getting “Couldn't connect to host
“, and I have this problem only with this one site which is one wpengine.
This is my CURL
code for connection
$vars = json_encode (
array(
//some params
)
);
$headers = array(
'Accept: application/json',
'Content-Type: application/json',
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://myproduction.com/');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $vars);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$result = curl_exec($ch);
return json_decode($result);
This prolem was happening some time and then suddenly It start to work fine with myproduction site again and all works fine, but now I cannot to connect it with my copy of production site which is on another server (‘https://myproductioncopy.com/‘). The same error is for copy of production and it’s only problem with this site on wp engine.
Have anyone idea what could be a reason of this, or how to find issue or to fix, anything, because I am without any idea.