If you have well formatted SOAP or MIME messages, here's a simple PHP script that allows you to do so. The function returns the reply from the server.
- //----------------------------------------------------------------- execCurl --
- function execCurl($url, $header, $query)
- {
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
- $r = curl_exec($ch);
- if (curl_errno($ch)) {
- echo curl_error($ch);
- exit(1);
- }
- curl_close($ch);
- return $r;
- }
No comments:
Post a Comment