Skip to content

Instantly share code, notes, and snippets.

@mattiaa95
Created June 24, 2020 18:46
Show Gist options
  • Save mattiaa95/9dcc0885c426d6b9b82b795756c85945 to your computer and use it in GitHub Desktop.
Save mattiaa95/9dcc0885c426d6b9b82b795756c85945 to your computer and use it in GitHub Desktop.
PHP Post replication to other domain with disable SSL Verification
<?php
//API URL
$url = '';
$ch = curl_init($url);
$jsonDataEncoded = file_get_contents('php://input');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonDataEncoded);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_exec($ch);
if (!curl_errno($ch)) {
switch ($http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE)) {
case 200:
echo($html);
break;
default:
http_response_code($http_code);
}
}
curl_close($ch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment