Jump to content

Ashley Stern

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Ashley Stern

  1. As I said,

     

    You need to use xmlHttpRequest object in Javascript, or cURL in PHP to achieve that. And no it's not that hard, just Google cURL or xmlHttpRequest, and read up.

     

    Taken from php.net (http://php.net/manual/en/book.curl.php):

     

    <?php
    $data = "<soap:Envelope>[...]</soap:Envelope>";
    $tuCurl = curl_init();
    curl_setopt($tuCurl, CURLOPT_URL, "https://example.com/path/for/soap/url/");
    curl_setopt($tuCurl, CURLOPT_PORT , 443);
    curl_setopt($tuCurl, CURLOPT_VERBOSE, 0);
    curl_setopt($tuCurl, CURLOPT_HEADER, 0);
    curl_setopt($tuCurl, CURLOPT_SSLVERSION, 3);
    curl_setopt($tuCurl, CURLOPT_SSLCERT, getcwd() . "/client.pem");
    curl_setopt($tuCurl, CURLOPT_SSLKEY, getcwd() . "/keyout.pem");
    curl_setopt($tuCurl, CURLOPT_CAINFO, getcwd() . "/ca.pem");
    curl_setopt($tuCurl, CURLOPT_POST, 1);
    curl_setopt($tuCurl, CURLOPT_SSL_VERIFYPEER, 1);
    curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($tuCurl, CURLOPT_POSTFIELDS, $data);
    curl_setopt($tuCurl, CURLOPT_HTTPHEADER, array("Content-Type: text/xml","SOAPAction: \"/soap/action/query\"", "Content-length: ".strlen($data)));
    
    $tuData = curl_exec($tuCurl);
    if(!curl_errno($tuCurl)){
     $info = curl_getinfo($tuCurl);
     echo 'Took ' . $info['total_time'] . ' seconds to send a request to ' . $info['url'];
    } else {
     echo 'Curl error: ' . curl_error($tuCurl);
    }
    
    curl_close($tuCurl);
    echo $tuData;
    ?>

     

     

    I think he finds the js object easier than the curl concept.

×
×
  • Create New...