Advertisement
Guest User

Untitled

a guest
Dec 28th, 2015
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. $(document).ready(function(){
  2. $("#doCall").click(function(){
  3. $.ajax({
  4. cache : false,
  5. type : 'POST',
  6. url : 'test.php',
  7. success : function (response) {
  8. console.log(response);
  9. },
  10. error : function () {
  11. console.log("Server side error, try later!");
  12. }
  13. });
  14. });
  15. });
  16.  
  17. <?php
  18. $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">
  19. <soapenv:Header/>
  20. <soapenv:Body> <ws:uploadCSRP soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  21. <email xsi:type="xsd:string">myemail@email.com</email>
  22. <pw xsi:type="xsd:string">pass123</pw>
  23. <pid xsi:type="xsd:string">111</pid>
  24. <buildID xsi:type="xsd:string">1.0</buildID>
  25. <fileDataType xsi:type="xsd:string">S</fileDataType>
  26. <fileToUpload xsi:type="xsd:string"><![CDATA[10038|Dickson Motor Service, Inc.|Dickson Motor Service, Inc.|SS4u@att.net|*
  27. 10040|Ramus Companies, Inc.|Ramus Companies|DD@gmail.com|*
  28. ]]></fileToUpload>
  29. </ws:uploadCSRP> </soapenv:Body></soapenv:Envelope>
  30. ';
  31. $ch = curl_init();
  32. curl_setopt($ch, CURLOPT_URL, "MyURL");
  33. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  34. curl_setopt($ch, CURLOPT_TIMEOUT, 60000);
  35. curl_setopt($ch,CURLOPT_POST, 1);
  36. curl_setopt($ch,CURLOPT_POSTFIELDS, $data);
  37. curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, 0);
  38. curl_setopt($ch,CURLOPT_HTTPHEADER, array("Content-Type: text/xml;charset=UTF-8", "SoapAction: *"));
  39. $content = trim(curl_exec($ch));
  40. curl_close($ch);
  41. $myfile = fopen("response.txt", "w") or die("Unable to open file!");
  42. fwrite($myfile, $content);
  43. fclose($myfile);
  44. echo done;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement