Skip to content

Instantly share code, notes, and snippets.

@gabrielem
Created October 17, 2014 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielem/e05f1e1c1005b7615c8d to your computer and use it in GitHub Desktop.
Save gabrielem/e05f1e1c1005b7615c8d to your computer and use it in GitHub Desktop.
sendPost()
<?php
function sendPost($URL,$postData){
$useragent = $_SERVER['HTTP_USER_AGENT'];
$enCRYPTING = $this->enCrypt(serialize($postData),$this->PRIVATE_KEY);
$postData_EnCrypt['request'] = $enCRYPTING;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$URL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
http_build_query(
$postData_EnCrypt
));
// receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_USERAGENT, $useragent);
$result = curl_exec ($ch);
curl_close ($ch);
return $result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment