preg_match ile elementlerin id ve class değerlerini almak

PHP:
  1. <?
  2. // Sadece id değerlerini almak
  3. $indexHtml = implode('',file("kaynakKlasor/index.htm"));
  4. preg_match_all('#id="(.*?)">#si',$indexHtml,$cikti);
  5. for($i=0;$i<count($cikti[1]);$i++){
  6. echo strip_tags($cikti[1][$i])."<br>";
  7. }
  8. ?>

PHP:
  1. <?
  2. // Sadece class değerlerini almak
  3. $indexHtml = implode('',file("kaynakKlasor/index.htm"));
  4. preg_match_all('#class="(.*?)">#si',$indexHtml,$cikti);
  5. for($i=0;$i<count($cikti[1]);$i++){
  6. echo strip_tags($cikti[1][$i])."<br>";
  7. }
  8. ?>

PHP:
  1. <?
  2. // Özelleştirme yaparak sadece div elementlerinin id değerlerini almak
  3. $indexHtml = implode('',file("kaynakKlasor/index.htm"));
  4. preg_match_all('#<div id="(.*?)">#si',$indexHtml,$cikti);
  5. for($i=0;$i<count($cikti[1]);$i++){
  6. echo strip_tags($cikti[1][$i])."<br>";
  7. }
  8. ?>

26 views

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word