Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 29th, 2012  |  syntax: None  |  size: 0.89 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. how to make an anchor url via foreach using grabbed URL n TITLE
  2. //gets URLs of href='xxxx'  
  3.  preg_match_all('/a href="([^"]+)" class=l.+?>.+?</a>/',$sear,$results);
  4.  
  5. //gets titles of >xxxx</a>  
  6.     preg_match_all('/a href=".+?" class=l.+?>([^"]+)</a>/',$sear,$t);
  7.        
  8. foreach ($results[1] as $url)
  9. {
  10. echo "<a href='$url'>$u</a> <br>";
  11.  
  12. $i++;
  13. }
  14.        
  15. foreach ($t[1] as $title)
  16.    {
  17.    echo $title;
  18.    $i++;
  19.    }
  20.        
  21. <a href='URL'>Title</a>
  22.        
  23. preg_match_all('/a href="([^"]+)" class=l.+?>(.+?)</a>/',$sear,$results, PREG_SET_ORDER);
  24.        
  25. preg_match_all('/a href="([^"]+)" class=l.+?>([^"]+)</a>/',$sear,$results);
  26.        
  27. foreach ($results as $link) {
  28.   $url = $link[1];
  29.   $text = $link[2];
  30.  
  31.   echo "Link '$text' to $url";
  32. }
  33.        
  34. if ( count($result[1]) == count($t[1]) ){
  35.     for ( $i = 0; $i < count($result[1]); $i++ ){
  36.         echo "<a href='" . $result[1][$i] . "'>" . $t[1][$i] . "</a> <br>";
  37.     }
  38. }