Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][cURL] Pobranie źródła strony
trollman
post
Post #1





Grupa: Zarejestrowani
Postów: 23
Pomógł: 0
Dołączył: 14.12.2012

Ostrzeżenie: (0%)
-----


Witam.
Mam problem gdyż chciałbym pobrać źródło strony i z niego wyciągnąć odpowiedni fragment kodu javascript.
Napisałem taką funkcję

  1.  
  2. <?php
  3. $cookie_file ="cookie.txt";
  4. //$url ='http://adresstrony.pl';
  5. $ch=curl_init($url);
  6. curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
  7. curl_setopt($ch,CURLOPT_TIMEOUT,50);
  8. curl_setopt($ch,CURLOPT_HEADER,0);
  9. curl_setopt($ch,CURLOPT_REFERER,$url);
  10. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0');
  11. curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
  12. curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
  13. $soursas=curl_exec($ch);
  14. curl_close($ch);
  15.  
  16. $pattern = '/<script(.*)<\/script>/';
  17. preg_match_all($pattern, $soursas, $matches);
  18. echo '<pre>'; print_r($matches); echo '</pre>';
  19.  
  20. ?>


I nie wiem co robie źle ale ten pattern nie wyciąga ma całego kodu skryptu (ze strony )tylko jego deklaracja takie jak:
[4] => type="text/javascript" src="/js/swfobject.js">
[5] => type="text/javascript" src="/js/colorpicker.js">
[6] => type='text/javascript' src='/js/jquery.cookie.js'>
[7] => type='text/javascript' src='/js/json2.js'>

Jak wcyiągnąć cały kod javacript ze źródła strony?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
trollman
post
Post #2





Grupa: Zarejestrowani
Postów: 23
Pomógł: 0
Dołączył: 14.12.2012

Ostrzeżenie: (0%)
-----


To może inaczej, mam taki kod w pobranym źrdóle

  1. <script type="text/javascript">
  2. var somdfunction = function() {
  3. var a = 783538;
  4. document.getElementById('dlbutton').omg = 783541%78956;
  5. var b = parseInt(document.getElementById('dlbutton').omg) * (783541%3);
  6. var e = function() {if (false) {return a+b+c} else {return (a+3)%b + 3}};
  7. document.getElementById('dlbutton').href = "/d/34751941/"+(b+18)+"/Electro%20House%20Drop%202k14%20by%20Tobii.mp3";
  8. if (document.getElementById('fimage')) {
  9. document.getElementById('fimage').href = "/i/34751941/"+(b+18)+"/Electro%20House%20Drop%202k14%20by%20Tobii.mp3";
  10. }
  11. var result = 0;
  12. }
  13. </script>


I jak z niego wydobyć wartość: 783541%78956
Bo wyrażeniami regularnymi go nie wychwytuje.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 16.10.2025 - 17:44