Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. $accountno = $account_id;
  2.  
  3. //to insert data into the system we need a valid hash
  4. $hash = "a4d70e75d403e037c7a537bcac2be9c2";
  5. $notify = "myles.panayiotis@oneradar.com";
  6. //define what area to insert to
  7. $area = "250";
  8. //creating the xml document
  9. $doc = new DOMDocument('1.0');
  10. $doc->formatOutput = true;
  11. //everything is contained in the import data tag
  12. $importdata = $doc->createElement("importdata");
  13. $doc->appendChild($importdata);
  14. //Element for target area
  15. $area = $doc->createElement("area",$area);
  16. $importdata->appendChild($area);
  17. //Create data tag
  18. $data = $doc->createElement("data");
  19. //Create Notify element
  20. $notify = $doc->createElement("notify",$notify);
  21. $data->appendChild($notify);
  22. $importdata->appendChild($data);
  23. //Create account tag
  24. $account = $doc->createElement("account");
  25. //Create account number if using custom number, uncomment 2 lines below
  26. $accountno = $doc->createElement("accountno",$accountno);
  27. $account->appendChild($accountno);
  28.  
  29. $j = $doc->createElement("field","Uploadededed");
  30. $j->setAttribute("table", "RCMANL");
  31. $j->setAttribute("field", "ANAL77");
  32. $account->appendChild($j);
  33.  
  34. $j = $doc->createElement("field","Tech insight");
  35. $j->setAttribute("table", "SPECIAL");
  36. $j->setAttribute("field", "ACTIVITY");
  37. $account->appendChild($j);
  38.  
  39. $j = $doc->createElement("field","Tech insight whitepaper click - Lead confirmed");
  40. $j->setAttribute("table", "SPECIAL");
  41. $j->setAttribute("field","COMMENTS");
  42. $account->appendChild($j);
  43.  
  44. $j = $doc->createElement("field","closed");
  45. $j->setAttribute("table", "TELCOM");
  46. $j->setAttribute("field", "SUBSTATUS");
  47. $account->appendChild($j);
  48.  
  49. $j = $doc->createElement("field","This is a test");
  50. $j->setAttribute("table", "TELCOM");
  51. $j->setAttribute("field", "CUSTOMERSTATUS");
  52. $account->appendChild($j);
  53.  
  54. $data->appendChild($account);
  55.  
  56. $xml = $doc->saveXML();
  57. //Change this to the long url of your system, if unsure what this is
  58. //please ask support
  59. $url = "https://europe4.callprocrm.com/609839/api.php?mode=import&hash=" . $hash;
  60. //start curl
  61. $ch = curl_init();
  62. //set the url, number of POST vars, POST data
  63. $data = array("xml" => $xml);
  64. curl_setopt($ch,CURLOPT_URL, $url);
  65. curl_setopt($ch, CURLOPT_POST, 1);
  66. curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  67. curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  68. $result = curl_exec($ch);
  69. curl_close($ch);
  70. //echo $result;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement