Skip to content

Instantly share code, notes, and snippets.

@wmucheru
Created January 7, 2018 16:04
Show Gist options
  • Save wmucheru/d5f9dd89c7b802e69f1908a8f20e20dc to your computer and use it in GitHub Desktop.
Save wmucheru/d5f9dd89c7b802e69f1908a8f20e20dc to your computer and use it in GitHub Desktop.
Make a Soap Request using PHP
function makeSOAPRequest($url, $soap_body){
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $url);
curl_setopt( $ch, CURLOPT_POST, true);
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $soap_body);
$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