Advertisement
Guest User

Untitled

a guest
Dec 17th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.18 KB | None | 0 0
  1. {
  2. "26":{
  3. "adUrl":"http://www.parseme.vacau.com/index.php?page=search&sCategory=26",
  4. "title":"Engineering Geologist Figueres",
  5. "salary":"2300.00 Euro u20ac",
  6. "category":"ENGINEERING - ARCHITECTURE",
  7. "publishedDate":"2013-05-07",
  8. "modifiedDate":"2013-05-27",
  9. "country":"Spain",
  10. "region":"Girona",
  11. "city":"Figueres",
  12. "cityArea":"Vilatenim",
  13. "address":"Pla Del Marquu00e8s, 13",
  14. "description":"<p><b>THIS ADVERT IS NOT RELA[... cropped to sample ...] ts and acting as represenattive on site.</p>",
  15. "imageUrl":"http://www.parseme.vacau.com/oc-content/uploads/65.jpg"
  16. },
  17. "30":{
  18. "adUrl":"http://www.parseme.vacau.com/index.php?page=search&sCategory=30",
  19. "title":"Engineering Barcelona",
  20. "salary":"2300.00 Euro u20ac",
  21. "category":"ENGINEERING - ARCHITECTURE",
  22. "publishedDate":"2013-05-07",
  23. "modifiedDate":"2013-05-27",
  24. "country":"Spain",
  25. "region":"Barcelona",
  26. "city":"Barcelona",
  27. "cityArea":"",
  28. "address":"",
  29. "description":"<p><b>THIS ADVERT IS NOT RELA[... cropped to sample ...] ts and acting as represenattive on site.</p>",
  30. "imageUrl":"http://www.parseme.vacau.com/oc-content/uploads/48.jpg"
  31. }
  32. }
  33.  
  34. <?php
  35.  
  36. $json = '{
  37. "26":{
  38. "adUrl":"http://www.parseme.vacau.com/index.php?page=search&sCategory=26",
  39. "title":"Engineering Geologist Figueres",
  40. "salary":"2300.00 Euro u20ac",
  41. "category":"ENGINEERING - ARCHITECTURE",
  42. "publishedDate":"2013-05-07",
  43. "modifiedDate":"2013-05-27",
  44. "country":"Spain",
  45. "region":"Girona",
  46. "city":"Figueres",
  47. "cityArea":"Vilatenim",
  48. "address":"Pla Del Marquu00e8s, 13",
  49. "description":"<p><b>THIS ADVERT IS NOT RELA[... cropped to sample ...] ts and acting as represenattive on site.</p>",
  50. "imageUrl":"http://www.parseme.vacau.com/oc-content/uploads/65.jpg"
  51. },
  52. "30":{
  53. "adUrl":"http://www.parseme.vacau.com/index.php?page=search&sCategory=30",
  54. "title":"Engineering Barcelona",
  55. "salary":"2300.00 Euro u20ac",
  56. "category":"ENGINEERING - ARCHITECTURE",
  57. "publishedDate":"2013-05-07",
  58. "modifiedDate":"2013-05-27",
  59. "country":"Spain",
  60. "region":"Barcelona",
  61. "city":"Barcelona",
  62. "cityArea":"",
  63. "address":"",
  64. "description":"<p><b>THIS ADVERT IS NOT RELA[... cropped to sample ...] ts and acting as represenattive on site.</p>",
  65. "imageUrl":"http://www.parseme.vacau.com/oc-content/uploads/48.jpg"
  66. }
  67. }';
  68.  
  69. $arr = json_decode($json, true);
  70.  
  71. $last_arr = end($arr);
  72.  
  73. foreach ($last_arr as $key => $value) {
  74. $message .= $value . '<br>';
  75. }
  76.  
  77. require 'PHPMailerAutoload.php';
  78.  
  79. $mail = new PHPMailer;
  80.  
  81. $mail->isSMTP(); // Set mailer to use SMTP
  82. $mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup server
  83. $mail->SMTPAuth = true; // Enable SMTP authentication
  84. $mail->Username = 'jswan'; // SMTP username
  85. $mail->Password = 'secret'; // SMTP password
  86. $mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
  87.  
  88. $mail->From = 'from@example.com';
  89. $mail->FromName = 'Mailer';
  90. $mail->addAddress('josh@example.net', 'Josh Adams'); // Add a recipient
  91. $mail->addAddress('ellen@example.com'); // Name is optional
  92. $mail->addReplyTo('info@example.com', 'Information');
  93. $mail->addCC('cc@example.com');
  94. $mail->addBCC('bcc@example.com');
  95.  
  96. $mail->WordWrap = 50; // Set word wrap to 50 characters
  97. $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
  98. $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
  99. $mail->isHTML(true); // Set email format to HTML
  100.  
  101. $mail->Subject = 'Here is the subject';
  102. $mail->Body = $message;
  103. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  104.  
  105. if(!$mail->send()) {
  106. echo 'Message could not be sent.';
  107. echo 'Mailer Error: ' . $mail->ErrorInfo;
  108. exit;
  109. }
  110.  
  111. echo 'Message has been sent';
  112.  
  113. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement