Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.31 KB | None | 0 0
  1. <tv generator-info-name="www.myscript.com/xmltv">
  2. <channel id="101 ABC FAMILY">
  3. <display-name>101 ABC FAMILY</display-name>
  4. <programme channel="101 ABC FAMILY" start="20140406153000" stop="20140406183000">
  5. <title lang="en"/>
  6. <sub-title lang="en"/>
  7. <desc lang="en"/>
  8. <category lang="en"/>
  9. </programme>
  10. <programme channel="101 ABC FAMILY" start="20140406183000" stop="20140406210000">
  11. <title lang="en"/>
  12. <sub-title lang="en"/>
  13. <desc lang="en"/>
  14. <category lang="en"/>
  15. </programme>
  16. <programme channel="101 ABC FAMILY" start="20140406210000" stop="20140406120000">
  17. <title lang="en"/>
  18. <sub-title lang="en"/>
  19. <desc lang="en"/>
  20. <category lang="en"/>
  21. </programme>
  22. <programme channel="101 ABC FAMILY" start="20140406120000" stop="20140406123000">
  23. <title lang="en"/>
  24. <sub-title lang="en"/>
  25. <desc lang="en"/>
  26. <category lang="en"/>
  27. </programme>
  28. <programme channel="101 ABC FAMILY" start="20140406123000" stop="2014040610000">
  29. <title lang="en"/>
  30. <sub-title lang="en"/>
  31. <desc lang="en"/>
  32. <category lang="en"/>
  33. </programme>
  34. <programme channel="101 ABC FAMILY" start="2014040610000" stop="2014040613000">
  35. <title lang="en"/>
  36. <sub-title lang="en"/>
  37. <desc lang="en"/>
  38. <category lang="en"/>
  39. </programme>
  40. <programme channel="101 ABC FAMILY" start="2014040613000" stop="2014040623000">
  41. <title lang="en"/>
  42. <sub-title lang="en"/>
  43. <desc lang="en"/>
  44. <category lang="en"/>
  45. </programme>
  46. <programme channel="101 ABC FAMILY" start="2014040623000" stop="2014040630000">
  47. <title lang="en"/>
  48. <sub-title lang="en"/>
  49. <desc lang="en"/>
  50. <category lang="en"/>
  51. </programme>
  52. <programme channel="101 ABC FAMILY" start="2014040630000" stop="">
  53. <title lang="en"/>
  54. <sub-title lang="en"/>
  55. <desc lang="en"/>
  56. <category lang="en"/>
  57. </programme>
  58. </channel>
  59.  
  60. <?php
  61. ini_set('max_execution_time', 300);
  62. $errmsg_arr = array();
  63. $errflag = false;
  64. $link;
  65. include ('simple_html_dom.php');
  66. $html = file_get_html("http://www.mysite.com/get-listing.php?channels=" . $channel . "&id=" . $my_id);
  67.  
  68. $time1 = $html_two->find('span[id=time1]',0)->plaintext;
  69. $title1 = $html_two->find('span[id=title1]',0)->plaintext;
  70.  
  71. $time1 = explode(" ", $time1);
  72. $hoursMinutes = explode(":", $time1[0]);
  73. $hours = $hoursMinutes[0];
  74. $minutes = $hoursMinutes[1];
  75.  
  76. if($time1[1] == "PM")
  77. {
  78. $time1[0] = date("Ymd") . ((int)($hours) + 12) . $minutes . "00";
  79. }
  80. else
  81. {
  82. $time1[0] = date("Ymd") . $hours . $minutes . "00";
  83. }
  84. $program_list[$count]['start_time1'] = $time1[0];
  85. $program_list[$count]['title1'] = $title1;
  86.  
  87. //time2
  88. $time2 = $html_two->find('span[id=time2]', 0)->plaintext;
  89. $title2 = $html_two->find('span[id=title2]', 0)->plaintext;
  90.  
  91. $time2 = explode(" ", $time2);
  92. $hoursMinutes = explode(":", $time2[0]);
  93. $hours = $hoursMinutes[0];
  94. $minutes = $hoursMinutes[1];
  95.  
  96. if($time2[1] == "PM")
  97. {
  98. $time2[0] = date("Ymd") . ((int)($hours) + 12) . $minutes . "00";
  99. }
  100. else
  101. {
  102. $time2[0] = date("Ymd") . $hours . $minutes . "00";
  103. }
  104. $program_list[$count]['end_time1'] = $time2[0];
  105. $program_list[$count]['start_time2'] = $time2[0];
  106. $program_list[$count]['title2'] = $title2;
  107.  
  108. //time3
  109. $time3 = $html_two->find('span[id=time3]', 0)->plaintext;
  110. $title3 = $html_two->find('span[id=title3]', 0)->plaintext;
  111.  
  112. $time3 = explode(" ", $time3);
  113. $hoursMinutes = explode(":", $time3[0]);
  114. $hours = $hoursMinutes[0];
  115. $minutes = $hoursMinutes[1];
  116.  
  117. if($time3[1] == "PM")
  118. {
  119. $time3[0] = date("Ymd") . ((int)($hours) + 12) . $minutes . "00";
  120. }
  121. else
  122. {
  123. $time3[0] = date("Ymd") . $hours . $minutes . "00";
  124. }
  125. $program_list[$count]['end_time2'] = $time3[0];
  126. $program_list[$count]['start_time3'] = $time3[0];
  127. $program_list[$count]['title3'] = $title3;
  128.  
  129. //time4
  130. $time4 = $html_two->find('span[id=time4]', 0)->plaintext;
  131. $title4 = $html_two->find('span[id=title4]', 0)->plaintext;
  132.  
  133. $time4 = explode(" ", $time4);
  134. $hoursMinutes = explode(":", $time4[0]);
  135. $hours = $hoursMinutes[0];
  136. $minutes = $hoursMinutes[1];
  137.  
  138. if($time4[1] == "PM")
  139. {
  140. $time4[0] = date("Ymd") . ((int)($hours) + 12) . $minutes . "00";
  141. }
  142. else
  143. {
  144. $time4[0] = date("Ymd") . $hours . $minutes . "00";
  145. }
  146. $program_list[$count]['end_time3'] = $time4[0];
  147. $program_list[$count]['start_time4'] = $time4[0];
  148. $program_list[$count]['title4'] = $title4;
  149.  
  150. //time5
  151. $time5 = $html_two->find('span[id=time5]', 0)->plaintext;
  152. $title5 = $html_two->find('span[id=title5]', 0)->plaintext;
  153.  
  154. $time5 = explode(" ", $time5);
  155. $hoursMinutes = explode(":", $time5[0]);
  156. $hours = $hoursMinutes[0];
  157. $minutes = $hoursMinutes[1];
  158.  
  159. if($time5[1] == "PM")
  160. {
  161. $time5[0] = date("Ymd") . ((int)($hours) + 12) . $minutes . "00";
  162. }
  163. else
  164. {
  165. $time5[0] = date("Ymd") . $hours . $minutes . "00";
  166. }
  167. $program_list[$count]['end_time4'] = $time5[0];
  168. $program_list[$count]['start_time5'] = $time5[0];
  169. $program_list[$count]['title5'] = $title5;
  170.  
  171. //time6
  172. $time6 = $html_two->find('span[id=time6]', 0)->plaintext;
  173. $title6 = $html_two->find('span[id=title6]', 0)->plaintext;
  174.  
  175. $time6 = explode(" ", $time6);
  176. $hoursMinutes = explode(":", $time6[0]);
  177. $hours = $hoursMinutes[0];
  178. $minutes = $hoursMinutes[1];
  179.  
  180. if($time6[1] == "PM")
  181. {
  182. $time6[0] = date("Ymd") . ((int)($hours) + 12) . $minutes . "00";
  183. }
  184. else
  185. {
  186. $time6[0] = date("Ymd") . $hours . $minutes . "00";
  187. }
  188. $program_list[$count]['end_time5'] = $time6[0];
  189. $program_list[$count]['start_time6'] = $time6[0];
  190. $program_list[$count]['title6'] = $title6;
  191.  
  192. //time7
  193. $time7 = $html_two->find('span[id=time7]', 0)->plaintext;
  194. $title7 = $html_two->find('span[id=title7]', 0)->plaintext;
  195.  
  196. $time7 = explode(" ", $time7);
  197. $hoursMinutes = explode(":", $time7[0]);
  198. $hours = $hoursMinutes[0];
  199. $minutes = $hoursMinutes[1];
  200.  
  201. if($time7[1] == "PM")
  202. {
  203. $time7[0] = date("Ymd") . ((int)($hours) + 12) . $minutes . "00";
  204. }
  205. else
  206. {
  207. $time7[0] = date("Ymd") . $hours . $minutes . "00";
  208. }
  209. $program_list[$count]['end_time6'] = $time7[0];
  210. $program_list[$count]['start_time7'] = $time7[0];
  211. $program_list[$count]['title7'] = $title7;
  212.  
  213. //time8
  214. $time8 = $html_two->find('span[id=time8]', 0)->plaintext;
  215. $title8 = $html_two->find('span[id=title8]', 0)->plaintext;
  216.  
  217. $time8 = explode(" ", $time8);
  218. $hoursMinutes = explode(":", $time8[0]);
  219. $hours = $hoursMinutes[0];
  220. $minutes = $hoursMinutes[1];
  221.  
  222. if($time8[1] == "PM")
  223. {
  224. $time8[0] = date("Ymd") . ((int)($hours) + 12) . $minutes . "00";
  225. }
  226. else
  227. {
  228. $time8[0] = date("Ymd") . $hours . $minutes . "00";
  229. }
  230. $program_list[$count]['end_time7'] = $time8[0];
  231. $program_list[$count]['start_time8'] = $time8[0];
  232. $program_list[$count]['title8'] = $title8;
  233.  
  234. //time9
  235. $time9 = $html_two->find('span[id=time9]', 0)->plaintext;
  236. $title9 = $html_two->find('span[id=title9]', 0)->plaintext;
  237.  
  238. $time9 = explode(" ", $time9);
  239. $hoursMinutes = explode(":", $time9[0]);
  240. $hours = $hoursMinutes[0];
  241. $minutes = $hoursMinutes[1];
  242.  
  243. if($time9[1] == "PM")
  244. {
  245. $time9[0] = date("Ymd") . ((int)($hours) + 12) . $minutes . "00";
  246. }
  247. else
  248. {
  249. $time9[0] = date("Ymd") . $hours . $minutes . "00";
  250. }
  251. $program_list[$count]['end_time8'] = $time9[0];
  252. $program_list[$count]['start_time9'] = $time9[0];
  253. $xml .= "<channel id='" . $my_id. " " . $channel . "'>";
  254. $xml .= "<display-name>" . $my_id. " " . $channel;
  255. $xml .= "</display-name>";
  256. $xml .= "<programme channel='" . $my_id. " " . $channel . "' start='" . $program_list[$i]['start_time1'] . "' stop='" . $program_list[$i]['end_time1'] . "'>";
  257. $xml .= '<title lang="en">';
  258. $xml .= '</title>';
  259. $xml .= '<sub-title lang="en">';
  260. $xml .= '</sub-title>';
  261. $xml .= '<desc lang="en">';
  262. $xml .= '</desc>';
  263. $xml .= '<category lang="en">';
  264. $xml .= '</category>';
  265. $xml .= '</programme>';
  266.  
  267. ((int)($hours) + 12)
  268.  
  269. getPaddedHour((int)$hours, $time9[1]);
  270.  
  271. function getPaddedHour($hour, $meridian) {
  272. $ret = $hour;
  273. if ($meridian == 'AM' && $ret == 12) {
  274. $ret = 0;
  275. } else if ($meridian == 'PM' && $ret != 12) {
  276. $ret += 11;
  277. }
  278. if ($ret < 10) {
  279. $ret = '0'.$ret;
  280. }
  281. return $ret;
  282. }
  283.  
  284. $start_time = strtotime($html_two->find('span[id=time1]',0)->plaintext);
  285.  
  286. if ($start_time !== FALSE) {
  287. $program_list[$count]['start_time1'] = date('YmdHis', $time);
  288. } else {
  289. $program_list[$count]['start_time1'] = 'Not Available';
  290. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement