Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Jak odszyfrować HTML DOM
Forum PHP.pl > Forum > PHP
michalbd93
użyłem simple_html_dom i uzyskałem kod strony
object(simple_html_dom)#1 (23) { ["root"]=> object(simple_html_dom_node)#2 (9) { ["nodetype"]=> int(5) ["tag"]=> string(4) "root"...

jak go teraz odszyfrować jak dowiedzieć się jakie dane zawiera?
viking
Nie działa dokumentacja?
michalbd93
nie rozumiem chciałem pobrać dane a mam taki kod nie wiem o co chodzi z tą dokumentacją
ale rozumiem że dzięki temu dostanę te informacje które skrywa ?
Neutral
Może to pójdzie:

  1. echo $your_variable['nodetype'];


Lub:

  1. echo $your_variable[0]['nodetype'];

  1. echo $your_variable['nodetype'][0];

michalbd93
nie działa
michalbd93
sad.gif nie wiem jak to zrobić próbowałem i tylko się wkur..


dziękuję wszystkim za pomoc

mam coś takiego ale dalej nie wiem jak odczytać informacje z tego:
  1. object(simple_html_dom)#1 (23) {
  2. ["root"]=>
  3. object(simple_html_dom_node)#2 (9) {
  4. ["nodetype"]=>
  5. int(5)
  6. ["tag"]=>
  7. string(4) "root"
  8. ["attr"]=>
  9. array(0) {
  10. }
  11. ["children"]=>
  12. array(0) {
  13. }
  14. ["nodes"]=>
  15. array(1) {
  16. [0]=>
  17. object(simple_html_dom_node)#3 (9) {
  18. ["nodetype"]=>
  19. int(3)
  20. ["tag"]=>
  21. string(4) "text"
  22. ["attr"]=>
  23. array(0) {
  24. }
  25. ["children"]=>
  26. array(0) {
  27. }
  28. ["nodes"]=>
  29. array(0) {
  30. }
  31. ["parent"]=>
  32. *RECURSION*
  33. ["_"]=>
  34. array(1) {
  35. [4]=>
  36. string(1) "1"
  37. }
  38. ["tag_start"]=>
  39. int(0)
  40. ["dom":"simple_html_dom_node":private]=>
  41. *RECURSION*
  42. }
  43. }
  44. ["parent"]=>
  45. NULL
  46. ["_"]=>
  47. array(2) {
  48. [0]=>
  49. int(-1)
  50. [1]=>
  51. int(2)
  52. }
  53. ["tag_start"]=>
  54. int(0)
  55. ["dom":"simple_html_dom_node":private]=>
  56. *RECURSION*
  57. }
  58. ["nodes"]=>
  59. array(2) {
  60. [0]=>
  61. object(simple_html_dom_node)#2 (9) {
  62. ["nodetype"]=>
  63. int(5)
  64. ["tag"]=>
  65. string(4) "root"
  66. ["attr"]=>
  67. array(0) {
  68. }
  69. ["children"]=>
  70. array(0) {
  71. }
  72. ["nodes"]=>
  73. array(1) {
  74. [0]=>
  75. object(simple_html_dom_node)#3 (9) {
  76. ["nodetype"]=>
  77. int(3)
  78. ["tag"]=>
  79. string(4) "text"
  80. ["attr"]=>
  81. array(0) {
  82. }
  83. ["children"]=>
  84. array(0) {
  85. }
  86. ["nodes"]=>
  87. array(0) {
  88. }
  89. ["parent"]=>
  90. *RECURSION*
  91. ["_"]=>
  92. array(1) {
  93. [4]=>
  94. string(1) "1"
  95. }
  96. ["tag_start"]=>
  97. int(0)
  98. ["dom":"simple_html_dom_node":private]=>
  99. *RECURSION*
  100. }
  101. }
  102. ["parent"]=>
  103. NULL
  104. ["_"]=>
  105. array(2) {
  106. [0]=>
  107. int(-1)
  108. [1]=>
  109. int(2)
  110. }
  111. ["tag_start"]=>
  112. int(0)
  113. ["dom":"simple_html_dom_node":private]=>
  114. *RECURSION*
  115. }
  116. [1]=>
  117. object(simple_html_dom_node)#3 (9) {
  118. ["nodetype"]=>
  119. int(3)
  120. ["tag"]=>
  121. string(4) "text"
  122. ["attr"]=>
  123. array(0) {
  124. }
  125. ["children"]=>
  126. array(0) {
  127. }
  128. ["nodes"]=>
  129. array(0) {
  130. }
  131. ["parent"]=>
  132. object(simple_html_dom_node)#2 (9) {
  133. ["nodetype"]=>
  134. int(5)
  135. ["tag"]=>
  136. string(4) "root"
  137. ["attr"]=>
  138. array(0) {
  139. }
  140. ["children"]=>
  141. array(0) {
  142. }
  143. ["nodes"]=>
  144. array(1) {
  145. [0]=>
  146. *RECURSION*
  147. }
  148. ["parent"]=>
  149. NULL
  150. ["_"]=>
  151. array(2) {
  152. [0]=>
  153. int(-1)
  154. [1]=>
  155. int(2)
  156. }
  157. ["tag_start"]=>
  158. int(0)
  159. ["dom":"simple_html_dom_node":private]=>
  160. *RECURSION*
  161. }
  162. ["_"]=>
  163. array(1) {
  164. [4]=>
  165. string(1) "1"
  166. }
  167. ["tag_start"]=>
  168. int(0)
  169. ["dom":"simple_html_dom_node":private]=>
  170. *RECURSION*
  171. }
  172. }
  173. ["callback"]=>
  174. NULL
  175. ["lowercase"]=>
  176. bool(true)
  177. ["original_size"]=>
  178. int(1)
  179. ["size"]=>
  180. int(1)
  181. ["pos":protected]=>
  182. int(1)
  183. ["doc":protected]=>
  184. string(1) "1"
  185. ["char":protected]=>
  186. NULL
  187. ["cursor":protected]=>
  188. int(2)
  189. ["parent":protected]=>
  190. object(simple_html_dom_node)#2 (9) {
  191. ["nodetype"]=>
  192. int(5)
  193. ["tag"]=>
  194. string(4) "root"
  195. ["attr"]=>
  196. array(0) {
  197. }
  198. ["children"]=>
  199. array(0) {
  200. }
  201. ["nodes"]=>
  202. array(1) {
  203. [0]=>
  204. object(simple_html_dom_node)#3 (9) {
  205. ["nodetype"]=>
  206. int(3)
  207. ["tag"]=>
  208. string(4) "text"
  209. ["attr"]=>
  210. array(0) {
  211. }
  212. ["children"]=>
  213. array(0) {
  214. }
  215. ["nodes"]=>
  216. array(0) {
  217. }
  218. ["parent"]=>
  219. *RECURSION*
  220. ["_"]=>
  221. array(1) {
  222. [4]=>
  223. string(1) "1"
  224. }
  225. ["tag_start"]=>
  226. int(0)
  227. ["dom":"simple_html_dom_node":private]=>
  228. *RECURSION*
  229. }
  230. }
  231. ["parent"]=>
  232. NULL
  233. ["_"]=>
  234. array(2) {
  235. [0]=>
  236. int(-1)
  237. [1]=>
  238. int(2)
  239. }
  240. ["tag_start"]=>
  241. int(0)
  242. ["dom":"simple_html_dom_node":private]=>
  243. *RECURSION*
  244. }
  245. ["noise":protected]=>
  246. array(0) {
  247. }
  248. ["token_blank":protected]=>
  249. string(4) "
  250. "
  251. ["token_equal":protected]=>
  252. string(4) " =/>"
  253. ["token_slash":protected]=>
  254. string(6) " />
  255. "
  256. ["token_attr":protected]=>
  257. string(2) " >"
  258. ["_charset"]=>
  259. string(5) "UTF-8"
  260. ["_target_charset"]=>
  261. string(5) "UTF-8"
  262. ["default_br_text":protected]=>
  263. string(2) "
  264. "
  265. ["default_span_text"]=>
  266. string(1) " "
  267. ["self_closing_tags":protected]=>
  268. array(9) {
  269. ["img"]=>
  270. int(1)
  271. ["br"]=>
  272. int(1)
  273. ["input"]=>
  274. int(1)
  275. ["meta"]=>
  276. int(1)
  277. ["link"]=>
  278. int(1)
  279. ["hr"]=>
  280. int(1)
  281. ["base"]=>
  282. int(1)
  283. ["embed"]=>
  284. int(1)
  285. ["spacer"]=>
  286. int(1)
  287. }
  288. ["block_tags":protected]=>
  289. array(6) {
  290. ["root"]=>
  291. int(1)
  292. ["body"]=>
  293. int(1)
  294. ["form"]=>
  295. int(1)
  296. ["div"]=>
  297. int(1)
  298. ["span"]=>
  299. int(1)
  300. ["table"]=>
  301. int(1)
  302. }
  303. ["optional_closing_tags":protected]=>
  304. array(11) {
  305. ["tr"]=>
  306. array(3) {
  307. ["tr"]=>
  308. int(1)
  309. ["td"]=>
  310. int(1)
  311. ["th"]=>
  312. int(1)
  313. }
  314. ["th"]=>
  315. array(1) {
  316. ["th"]=>
  317. int(1)
  318. }
  319. ["td"]=>
  320. array(1) {
  321. ["td"]=>
  322. int(1)
  323. }
  324. ["li"]=>
  325. array(1) {
  326. ["li"]=>
  327. int(1)
  328. }
  329. ["dt"]=>
  330. array(2) {
  331. ["dt"]=>
  332. int(1)
  333. ["dd"]=>
  334. int(1)
  335. }
  336. ["dd"]=>
  337. array(2) {
  338. ["dd"]=>
  339. int(1)
  340. ["dt"]=>
  341. int(1)
  342. }
  343. ["dl"]=>
  344. array(2) {
  345. ["dd"]=>
  346. int(1)
  347. ["dt"]=>
  348. int(1)
  349. }
  350. ["p"]=>
  351. array(1) {
  352. ["p"]=>
  353. int(1)
  354. }
  355. ["nobr"]=>
  356. array(1) {
  357. ["nobr"]=>
  358. int(1)
  359. }
  360. ["b"]=>
  361. array(1) {
  362. ["b"]=>
  363. int(1)
  364. }
  365. ["option"]=>
  366. array(1) {
  367. ["option"]=>
  368. int(1)
  369. }
  370. }
  371. }



nie mam głowy do tego a muszę to zrobić
viking
To może najpierw powiedz co chcesz odczytać.
michalbd93
na początek to coś łatwego aby mi posłużyło za przykład

to jest własnie kod do tego

http://yourcoin.pl/rame.php

i to całe id ="video_api"


viking
  1. <?php
  2. include_once('simple_html_dom.php');
  3.  
  4.  
  5. $html = str_get_html('
  6. <iframe style=" background-repeat:no-repeat;
  7. background-size: 70% 100%;" src="http://filmexe.pl/filminstruktazowy.php" width="100%" height="305" frameborder="0" scrolling="no" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>');
  8.  
  9.  
  10. foreach($html->find('iframe') as $frame) {
  11. echo $frame->src;
  12. }
michalbd93
dziękuję za pomoc ale to nie do końca to

jak odczytać src="mov_bbb.mp4"?


jak się robi zbadaj stronę i daje mp4 to to widać

ale tak aby było bez wchodzenia na http://filmexe.pl/filminstruktazowy.php

mam taki

kodzik który wypluwa ten kod który podałem wyżej

i chce z tego wyciągnąć te informacje

  1. include('simple_html_dom.php');
  2. function get_data($url) {
  3. $ch = curl_init();
  4. $timeout = 30;
  5. curl_setopt($ch, CURLOPT_URL, $url);
  6. curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
  7. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
  8. curl_setopt($ch, CURLOPT_POST, false);
  9. curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:10.0) Gecko/20100101 Firefox/10.0");
  10. $dom = new simple_html_dom(curl_exec($ch));
  11. echo '<pre>'; var_dump($dom);
  12. echo '</pre>';
  13. curl_close($ch);
  14. return $dom;
  15.  
  16. }
  17. $url = 'http://yourcoin.pl/rame.php';
  18. $data = get_data($url);
  19.  


chyba że da się jeszcze jakoś inaczej
viking
  1. $html = file_get_html('http://yourcoin.pl/rame.php', false, null, 0);
  2.  
  3.  
  4. foreach($html->find('iframe') as $frame) {
  5. $html2 = file_get_html($frame->src, false, null, 0);
  6.  
  7. foreach($html2->find('video source') as $src) {
  8. echo $src->src;
  9. }
  10. }
michalbd93
wow o to mi chodziło Dziękuję !
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.