Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function(){
- $("#doCall").click(function(){
- $.ajax({
- cache : false,
- type : 'POST',
- url : 'test.php',
- success : function (response) {
- console.log(response);
- },
- error : function () {
- console.log("Server side error, try later!");
- }
- });
- });
- });
- <?php
- $data = '<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws">
- <soapenv:Header/>
- <soapenv:Body> <ws:uploadCSRP soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
- <email xsi:type="xsd:string">myemail@email.com</email>
- <pw xsi:type="xsd:string">pass123</pw>
- <pid xsi:type="xsd:string">111</pid>
- <buildID xsi:type="xsd:string">1.0</buildID>
- <fileDataType xsi:type="xsd:string">S</fileDataType>
- <fileToUpload xsi:type="xsd:string"><![CDATA[10038|Dickson Motor Service, Inc.|Dickson Motor Service, Inc.|SS4u@att.net|*
- 10040|Ramus Companies, Inc.|Ramus Companies|DD@gmail.com|*
- ]]></fileToUpload>
- </ws:uploadCSRP> </soapenv:Body></soapenv:Envelope>
- ';
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "MyURL");
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_TIMEOUT, 60000);
- curl_setopt($ch,CURLOPT_POST, 1);
- curl_setopt($ch,CURLOPT_POSTFIELDS, $data);
- curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($ch,CURLOPT_HTTPHEADER, array("Content-Type: text/xml;charset=UTF-8", "SoapAction: *"));
- $content = trim(curl_exec($ch));
- curl_close($ch);
- $myfile = fopen("response.txt", "w") or die("Unable to open file!");
- fwrite($myfile, $content);
- fclose($myfile);
- echo done;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement