[PHP] auslesen von links

Dieses Thema im Forum "Webentwicklung" wurde erstellt von user39422, 11. November 2008 .

Schlagworte:
Status des Themas:
Es sind keine weiteren Antworten möglich.
  1. 11. November 2008
    auslesen von links

    hey leute,
    also ich hab mich mal selbst ans coden gewagt und hab schon ein problem ^^

    hier mein code: index.php
    HTML:
    <?php include("header.php");?>
    <html>
    <head>
    <title>suchen</title>
    <link rel="stylesheet" type="text/css" href="style.css">
    </head>
    <body>
    <center><form action="results.php" method="post">
    suche:
    <input type="text" name="suche" size=50>
    <input type="submit" value="suchen"></center>
    <br><br><br><br>
    <span style='font-size: 11px;'><b>tags:</b></span>
    </form>
    </body>
    </html>
    
    und hier die results.php
    PHP:
    <? php  include( "header.php" );

    echo 
    "crystal-warez.in:</br>" ;
    $suche  $HTTP_POST_VARS [ "suche" ]; 
    $host  "http://crystal-warez.in/index.php?do=downloads&search=" . " $suche " ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '//show_download/' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }
    ?> 
    in der results.php werden von der seite mit dem eingegebenen string im formular "$suche" die links gefiltert da ich nicht alle links ausgegeben haben will sondern nur die links mit //show_download/

    das klappt alles wunderbar
    nur wenn ich noch eine seite hinzufügen will dann geht das nicht es erscheint nichts
    wie kann ich das machen dass ich mehrere seiten im script anspreche?
     
  2. 11. November 2008
    AW: auslesen von links

    hier habe ich nur die seite geändert, es kommt aber kein einziger link... was mache ich hier falsch?!

    PHP:
    <? php  include( "header.php" );

    echo 
    "crystal-warez.in:</br>" ;
    $suche  $HTTP_POST_VARS [ "suche" ]; 
    $host  "http://serienking.in/?q=" . " $suche " ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '?id=' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }
    ?> 
     
  3. 11. November 2008
    AW: auslesen von links

    hey,

    was meinst du mit weiteren seiten? du meinst "seiten" wie die buchseiten auf der selben homepage oder meinst du eine ganz andere homepage auf der ebenfalls gesucht werden soll?

    // edit:

    aha also eine ganz andere homepage. ja das kann mehrer gründe haben. entweder wird auf den refferer geachtet, dass dieser von der selben seite kommt. oder der user-agent muss erlaubt sein etc etc. versuch mit deinem script erstmal den ganzen inhalt der seite zu holen und auszugeben. wenn das auch nicht funktioniert, weißt du jetzt woran es liegt
     
  4. 11. November 2008
    AW: auslesen von links

    also die webseite kann ich komplett einlesen mit folgendem script:
    PHP:
    <? php 
    $url 
    "http://sceneload.to/?q=" ;
    $code  file_get_contents ( $url );
    echo 
    $code ;
    ?>
    nur wenn ich jetzt mein script benutze was mir die links filtert passiert nichts:
    PHP:
    echo  "</a><br>sceneload.to:</br>" ;
    $suche  $HTTP_POST_VARS [ "suche" ]; 
    $host  "http://sceneload.to/?q=" . " $suche " ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '/download/' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }
     
  5. 11. November 2008
    AW: auslesen von links

    Probiers mal "lieber" mit regulären Ausdrücken, ist damit viel bequemer als mit deinem Kram.
    PHP: preg_match_all - Manual sollte dir da behilflich sein. (sowie Reguläre Ausdrücke )
     
  6. 11. November 2008
    AW: auslesen von links

    Ja, Reguläre Ausdrücke sind in diesem Fall wirklich die bessere Lösung.

    Ich habe jetzt nicht konkret verstanden, was du suchst ...
    PHP:
    preg_match_all ( "/<a.*?href=\"(.*?)\".*?>.*?<\/a>/ium" $text $values );
    Liest alle Links aus, die mit <a> versetzt wurden, du kannst das z.B. noch einschränken, in dem du sagst, dass nur Links genommen werden sollen, die mit "http://" (also ausführende Links) anfangen, etc.pp.
     
  7. 11. November 2008
    AW: auslesen von links

    ok thx @telefonzelle & p0w3rn4t0r

    aber wo definiere ich die seite die er durchsuchen soll?
     
  8. 11. November 2008
    AW: auslesen von links

    diesen teil kannst du beibehalten. preg_match(_all) sucht nur innerhalt von einem string nach mustern. http://de.php.net/preg_match
    schau dir am besten mal allgemein "reguläre ausdrücke" an.

    greez myth
     
  9. 11. November 2008
    AW: auslesen von links

    array + foreach?

    Code:
    $sites = array('http://foo', 'http://bar');
    foreach($sites as $url) {
     //dein script?
    }
     
  10. 12. November 2008
    AW: auslesen von links

    @murdoc
    sehr intressant das mit dem array nur geht das nicht da ich die url mit dem eingegebenen suchwort kombiniere...

    hier einmal alle seiten auf denen ich suchen möchte:
    PHP:
    $suche  $_GET [ 'suche' ];
    $host  "http://crystal-warez.in/index.php?do=downloads&search=" . " $suche " ;
    echo 
    "</a><br> $host </br>" ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '//show_download/' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }

    $suche  $_GET [ 'suche' ];
    $host  "http://get-all.in/?s=" . " $suche " ;
    echo 
    "</a><br> $host </br>" ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '?p=' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }

    $suche  $_GET [ 'suche' ];
    $host  "http://epicspeedload.in/?q=" . " $suche " ;
    echo 
    "</a><br> $host </br>" ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '?id=' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }

    $suche  $_GET [ 'suche' ];
    $host  "http://fettrap.com/?q=" . " $suche " ;
    echo 
    "</a><br> $host </br>" ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '?id=' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }

    $suche  $_GET [ 'suche' ];
    $host  "http://gez-load.net/?q=" . " $suche " ;
    echo 
    "</a><br> $host </br>" ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '?id=' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }

    $suche  $_GET [ 'suche' ];
    $host  "http://www.oxygen-warez.com/?q=" . " $suche " ;
    echo 
    "</a><br> $host </br>" ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '?id=' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }

    $suche  $_GET [ 'suche' ];
    $host  "http://pirate-loads.com/?q=" . " $suche " ;
    echo 
    "</a><br> $host </br>" ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '?id=' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }

    $suche  $_GET [ 'suche' ];
    $host  "http://www.steelwarez.com/?q=" . " $suche " ;
    echo 
    "</a><br> $host </br>" ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '?id=' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }

    $suche  $_GET [ 'suche' ];
    $host  "http://falinks.com/?fa=" . " $suche " ;
    echo 
    "</a><br> $host </br>" ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '/link/' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }

    $suche  $_GET [ 'suche' ];
    $host  "http://serienking.in/?q=" . " $suche " ;
    echo 
    "</a><br> $host </br>" ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '/category/' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }

    $suche  $_GET [ 'suche' ]; 
    $host  "http://www.warez-load.com/?q=" . " $suche " ;
    echo 
    "</a><br> $host </br>" ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '/category/' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }

    $suche  $_GET [ 'suche' ];
    $host  "http://xtreme-warez.org/?q=" . " $suche " ;
    echo 
    "</a><br> $host </br>" ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '/category/' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }

    $suche  $_GET [ 'suche' ];
    $host  "http://your-load.com/?q=" . " $suche " ;
    echo 
    "</a><br> $host </br>" ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '/category/' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }

    $suche  $_GET [ 'suche' ];
    $host  "http://sound-load.com/?q=" . " $suche " ;
    echo 
    "</a><br> $host </br>" ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '/category/' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }

    $suche  $_GET [ 'suche' ];
    $host  "http://www.oneload.org/?q=" . " $suche " ;
    echo 
    "</a><br> $host </br>" ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '/category/' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }

    $suche  $_GET [ 'suche' ];
    $host  "http://ddl-scene.com/?q=" . " $suche " ;
    echo 
    "</a><br> $host </br>" ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '/category/' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }

    $suche  $_GET [ 'suche' ];
    $host  "http://sceneload.to/?q=" . " $suche " ;
    echo 
    "</a><br> $host </br>" ;
    $filestring  file_get_contents ( $host );
    $startpos  0 ;
    while(
    $pos  strpos ( $filestring "<a href" $startpos ))
    {
        
    $string  substr ( $filestring $pos strpos ( $filestring "</a>" $pos  1 ) -  $pos );

        if(
    stristr ( $string '/download/' )) {
            echo 
    $string . "</br>" ;
        }
        
    $startpos  $pos  1 ;
    }
     
  11. 12. November 2008
    AW: auslesen von links

    1. Wenn du einen gewissen Code hast, der sich x mal wiederholt, bietet es sich an eine Funktion dafür zu schreiben.

    2. Wieso benutzt du keine regulären Ausrücke?

    PHP:
    <? php

    $suche 
    "bond" ;

    $links  = array();

    function 
    loadURLs ( $host $regex )
    {
      global 
    $links ;
      
      
    $contents  file_get_contents ( $host );
      
    preg_match_all ( $regex $contents $values );
      
    $links [ $host ] =  $values [ 1 ];
    }

    loadURLs ( "http://epicspeedload.in/?q=" . $suche "/<a.*?href=\"(\/\?id=[0-9]{1,})\".*?>.*?<\/a>/ium" );
    loadURLs ( "http://fettrap.com/?q=" . $suche "/<a.*?href=\"(\/\?id=[0-9]{1,})\".*?>.*?<\/a>/ium" );

    echo 
    "<pre>" ;
    print_r ( $links );
    echo 
    "</pre>" ;
    ?>
    So sieht es für die ersten beiden Webseiten aus, musst eben für jede Website den reg. Ausdruck anpassen
     
  12. 13. November 2008
    AW: auslesen von links

    hallo p0w3rn4t0r,
    habe deinen code verwendet...
    jetzt bekomme ich folgende ausgabe:

    PHP:
    Array
    (
        [
    http : //fettrap.com/?q=sido] => Array
            
    (
                [
    0 ] => /? id = 14534
                
    [ 1 ] => /? id = 14535
                
    [ 2 ] => /? id = 13769
                
    [ 3 ] => /? id = 13772
                
    [ 4 ] => /? id = 745
                
    [ 5 ] => /? id = 12140
                
    [ 6 ] => /? id = 6356
                
    [ 7 ] => /? id = 15382
                
    [ 8 ] => /? id = 871
                
    [ 9 ] => /? id = 7551
                
    [ 10 ] => /? id = 1444
                
    [ 11 ] => /? id = 11020
                
    [ 12 ] => /? id = 15670
                
    [ 13 ] => /? id = 6385
                
    [ 14 ] => /? id = 8073
                
    [ 15 ] => /? id = 16866
                
    [ 16 ] => /? id = 8319
                
    [ 17 ] => /? id = 16601
                
    [ 18 ] => /? id = 15682
                
    [ 19 ] => /? id = 4675
                
    [ 20 ] => /? id = 15613
                
    [ 21 ] => /? id = 13776
                
    [ 22 ] => /? id = 13333
                
    [ 23 ] => /? id = 4674
                
    [ 24 ] => /? id = 4680
                
    [ 25 ] => /? id = 14519
                
    [ 26 ] => /? id = 13723
                
    [ 27 ] => /? id = 4681
                
    [ 28 ] => /? id = 3137
                
    [ 29 ] => /? id = 4932
                
    [ 30 ] => /? id = 16861
                
    [ 31 ] => /? id = 12510
                
    [ 32 ] => /? id = 16862
                
    [ 33 ] => /? id = 4929
                
    [ 34 ] => /? id = 13782
                
    [ 35 ] => /? id = 14521
                
    [ 36 ] => /? id = 16288
                
    [ 37 ] => /? id = 3577
                
    [ 38 ] => /? id = 8616
                
    [ 39 ] => /? id = 12511
                
    [ 40 ] => /? id = 14689
                
    [ 41 ] => /? id = 1069
                
    [ 42 ] => /? id = 12507
                
    [ 43 ] => /? id = 12506
                
    [ 44 ] => /? id = 12508
                
    [ 45 ] => /? id = 8875
                
    [ 46 ] => /? id = 8997
                
    [ 47 ] => /? id = 17122
                
    [ 48 ] => /? id = 16724
                
    [ 49 ] => /? id = 16849
                
    [ 50 ] => /? id = 14575
                
    [ 51 ] => /? id = 16864
                
    [ 52 ] => /? id = 12509
                
    [ 53 ] => /? id = 15190
                
    [ 54 ] => /? id = 14590
                
    [ 55 ] => /? id = 14592
                
    [ 56 ] => /? id = 16863
                
    [ 57 ] => /? id = 12512
                
    [ 58 ] => /? id = 1076
                
    [ 59 ] => /? id = 3500
                
    [ 60 ] => /? id = 12513
                
    [ 61 ] => /? id = 3499
                
    [ 62 ] => /? id = 4677
                
    [ 63 ] => /? id = 4678
                
    [ 64 ] => /? id = 1077
                
    [ 65 ] => /? id = 16868
                
    [ 66 ] => /? id = 16867
                
    [ 67 ] => /? id = 1079
                
    [ 68 ] => /? id = 8597
                
    [ 69 ] => /? id = 14572
                
    [ 70 ] => /? id = 16869
                
    [ 71 ] => /? id = 1072
                
    [ 72 ] => /? id = 7328
                
    [ 73 ] => /? id = 14486
                
    [ 74 ] => /? id = 13658
                
    [ 75 ] => /? id = 14681
                
    [ 76 ] => /? id = 14658
                
    [ 77 ] => /? id = 10847
                
    [ 78 ] => /? id = 14571
                
    [ 79 ] => /? id = 16870
                
    [ 80 ] => /? id = 11064
                
    [ 81 ] => /? id = 14514
                
    [ 82 ] => /? id = 14513
                
    [ 83 ] => /? id = 14348
                
    [ 84 ] => /? id = 16524
                
    [ 85 ] => /? id = 4679
                
    [ 86 ] => /? id = 14182
                
    [ 87 ] => /? id = 16497
                
    [ 88 ] => /? id = 14520
                
    [ 89 ] => /? id = 11727
                
    [ 90 ] => /? id = 13777
                
    [ 91 ] => /? id = 1104
                
    [ 92 ] => /? id = 6107
                
    [ 93 ] => /? id = 6109
                
    [ 94 ] => /? id = 4912
            
    )

    )
    kann ich das auch so ausgeben dass ich die links anklicken kann und direkt zu der seite komme?
     
  13. 13. November 2008
    AW: auslesen von links

    Hab den Thread nicht verfolgt, aber das "Problem" sollte mit einem kleinen foreach gelöst werden können:

    PHP:
    $links  = array(  "foo" "bar" "Sn0w"  );

    foreach(
    $links  as  $link )
    {
        echo 
    "<br /> <a href='http://fettrap.com/?q=sido" . $link . "'>" . $link . "</a>" ;
    }
    Einfach umändern, dass $links passt und beliebig formatieren.
    Kannst natürlich auch noch $link so zerlegen, dass Du nur die reine ID-Zahl hast und diese dann als Text für den Hyperlink <a> angeben.
     
  14. 13. November 2008
    AW: auslesen von links

    Das stimmt, itsfall, weil der Betreiber die Links so angibt.
    PHP:
    function  loadURLs ( $host $regex )
    {
      global 
    $links ;
      
      
    $contents  file_get_contents ( $host );
      
    preg_match_all ( $regex $contents $values );
      if (
    preg_match ( "/http:\/\/fettrap\.com/i" $host ))  $links [ $host ] =  "http://fettrap.com/?q=" . $values [ 1 ];
    }
    Musst eben für jeden "host" eine eigene if-Bedingung (nach meinem Beispiel) schreiben. Da das von Host zu Host meist unterschiedlich beschrieben wird, wollte ich es nicht verallgemeinern.

    ---

    Snowmans Methode stimmt nicht ganze, diese müsste wie folgt heißen:
    PHP:
    foreach ( $links  as  $host )
    {
      foreach (
    $host  as  $id )
      {
        if (
    $host == 'http://fettrap.com/?q=' . $suche ) echo  "<a href=\"http://fettrap.com/ $id \">Fettrap  $id </a><br />" ;
      }
    }
     
  15. 14. November 2008
    AW: auslesen von links

    wo genau an welcher stelle soll ich snowmans methode in den code einfügen??
     
  16. 14. November 2008
    AW: auslesen von links

    Direkt nach dem letzten "loadURLs" (aber meine Methode benutzen, da sie konkret an mein Script angepasst ist)
     
  17. 15. November 2008
    AW: auslesen von links

    ok habe deine methode eingebaut jetzt bekomme ich folgenden fehler:


    Fatal error: Cannot redeclare loadurls() (previously declared in W:\www\beta\results.php:19) in W:\www\beta\results.php on line 35

    auf zeile 35 ist die letzte klammer des codes..
     
  18. 15. November 2008
    AW: auslesen von links

    [G]Fatal error: Cannot redeclare[/G]
    -> http://www.php-fehlermeldungen.de/topic58.html
     
  19. 16. November 2008
    AW: auslesen von links

    also ich habe include_once probiert - ist aber nichts dabei raus gekommen.... außer n fehler...

    ich habe include_once so eingebaut:

    function include_once loadURLs($host, $regex)
    .....
     
  20. 16. November 2008
    AW: auslesen von links

    NEIN XD

    Die Datei, in der die Funktion deklariert wird, wird zwei mal geladen (daher der Fehler). Eine Funktion darf allerdings nur einmal exisitieren, sonst kommt der Fehler.
     
  21. 16. November 2008
    AW: auslesen von links

    ja ist mir klar...

    PHP:
    function  loadURLs ( $host $regex )
    {
    global 
    $links ;
    $contents  file_get_contents ( $host );
    preg_match_all ( $regex $contents $values );
    $links [ $host ] =  $values [ 1 ];
    }
    loadURLs ( "http://fettrap.com/?q=" . $suche "/<a.*?href=\"(\/\?id=[0-9]{1,})\".*?>.*?<\/a>/ium" );

    function 
    loadURLs ( $host $regex )
    {
      global 
    $links ;
      
      
    $contents  file_get_contents ( $host );
      
    preg_match_all ( $regex $contents $values );
      if (
    preg_match ( "/http:\/\/fettrap\.com/i" $host ))  $links [ $host ] =  "http://fettrap.com/?q=" . $values [ 1 ];

    nur wie kann ich das jetzt wieder hinbekommen...
     
  22. 16. November 2008
    AW: auslesen von links

    Die Funktion darf nur einmal stehen.

    Ich habe sie mal angepasst:
    PHP:
    <? php
    $suche 
    "bond" ;

    $links  = array();

    function 
    loadURLs ( $host $regex )
    {
      global 
    $links $suche ;
      
      
    $myhost  preg_replace ( "/^http\:\/\/(.*?)\/.*? $suche .*?$/i" "http://$1" $host );
      
    $array  = array();
      
      
    $contents  file_get_contents ( $host );
      
    preg_match_all ( $regex $contents $values );
      if (
    is_array ( $values [ 1 ]))
      foreach (
    $values [ 1 ] as  $linkid )
      {
        if (!
    strstr ( $linkid $myhost ))  $array [] =  $myhost . $linkid ;
        else 
    $array [] =  $linkid ;
      }
      
    $links [ $host ] =  $array ;
    }

    loadURLs ( "http://epicspeedload.in/?q=" . $suche "/<a.*?href=\"(\/\?id=[0-9]{1,})\".*?>.*?<\/a>/ium" );
    loadURLs ( "http://fettrap.com/?q=" . $suche "/<a.*?href=\"(\/\?id=[0-9]{1,})\".*?>.*?<\/a>/ium" );

    echo 
    "<pre>" ;
    print_r ( $links );
    echo 
    "</pre>" ;
    ?>
    Bei den zwei konkreten Beispielen klappt es, ich hoffe bei den anderen auch.

    Das Script holt sich die URL des Host in die Variable $myhost und nachher wird überprüft ob diese vorkommt, falls nicht, wird es vornerangesetzt.
     
  23. 16. November 2008
    AW: auslesen von links

    ok bis jetzt funktioniert das meiste..

    die links werden ausgegeben mit foreach

    PHP:
    foreach( $links  as  $results ){
           echo 
    "<a href=" . $results [ 0 ]. ">" . $results [ 0 ]. "</a><br>" ;
           echo 
    "<a href=" . $results [ 1 ]. ">" . $results [ 1 ]. "</a><br>" ;
           echo 
    "<a href=" . $results [ 2 ]. ">" . $results [ 2 ]. "</a><br>" ;
    }
    nur wie kann ich jetzt die namen von den links angeben damit man nicht den hyperlink sieht und wie kann ich alles auslesen ohne immer 0 1 2 ..... angeben zu müssen denn die ergebenisse sind immer unterschiedlich viele...

    und wenn ich viele adressen in loadURLs angebe dann werden nur die ersten 2 oder 3 seiten ausgegeben und bei den restlichen wird nichts angezeigt
     
  24. 16. November 2008
    AW: auslesen von links

    Bau 2 foreach-Schleifen ineinander:
    PHP:
    foreach ( $links  as  $arrays )
    {
      foreach (
    $arrays  as  $link )
      {
        echo 
    "<a href=\" { $link } \"> { $link } </a><br>" ;
      }
    }
    Warum Seiten nicht geladen werden kann ich dir nicht sagen, vielleicht ist PHP überlastet. Dies könnte man über AJAX lösen, dass du einzeln die PHP-Dateien aufrufst und dann quasi zu jedem Hoster das über AJAX aufrufst und lädst.
     
  25. 17. November 2008
    AW: auslesen von links

    genau soetwas in der art habe ich mir auch gedacht...
     
  26. Video Script

    Videos zum Themenbereich

    * gefundene Videos auf YouTube, anhand der Überschrift.