1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Script not returning

Discussion in 'PHP & Perl' started by megatr0n, Oct 24, 2015.

Tags:
  1. megatr0n

    megatr0n Newbie

    Joined:
    Nov 10, 2011
    Messages:
    17
    Likes Received:
    6
    I have a script that no longer returns. It times out and does not show anything:


    <?php
    FOR ($i = 1; $i <= 55; $i++)
    {
    $html = file_get_contents("httpcolon//wwwdotcool-proxydotnet/index.php?action=proxy-list&page=$i");

    preg_match_all('/<div align="left"><a href="(.*?)">(.*?)<\/a><\/div>/s',
    $html,
    $posts, // will contain the proxies
    PREG_SET_ORDER // formats data into an array of proxies
    );

    foreach ($posts as $post) {
    $link = $post[1];
    $title = $post[2];


    echo ("$title");
    echo "<br>";
    }
    }
    ?>
    Please help.
     
  2. roadhamster

    roadhamster Regular Member

    Joined:
    Mar 12, 2012
    Messages:
    335
    Likes Received:
    242
    Maybe they blocked your script, because they found out you were ripping their info? Did you use the script in a cron-job?

    What happens when you try only one request? What happens if you do an echo for the file_get_contents? Do you get any info? Check your script step-by-step and see what happens.
     
  3. megatr0n

    megatr0n Newbie

    Joined:
    Nov 10, 2011
    Messages:
    17
    Likes Received:
    6
    No I haven't used it in a cron but I may do so if I can get it to work. I can browse to the site. The only info I get is timeout from my webhost.
     
  4. roadhamster

    roadhamster Regular Member

    Joined:
    Mar 12, 2012
    Messages:
    335
    Likes Received:
    242
    As far as I can see you're ripping 55 pages in one run. Start with 1 page and see what comes out. If your host has set the PHP timeout lower than the script does a complete execute, then you get a timeout error. Maybe this is an option to put in your script:
    PHP:
    set_time_limit(0);
    , means that the script shouldn't timeout, but again, if you host (and he does) has set a time limit then you have to make another approach. For eample: let the script execute two times, first run pages 1 to 27, second run do the rest. If this also times out, split it into smaller pieces.
     
  5. megatr0n

    megatr0n Newbie

    Joined:
    Nov 10, 2011
    Messages:
    17
    Likes Received:
    6
    Instead of 55, I put 10. I now get a blank page.
     
  6. mantic0re

    mantic0re Junior Member

    Joined:
    May 29, 2015
    Messages:
    118
    Likes Received:
    9
    Try to wget to see if you can establish a connection at all. Secondly I would also recommend to use CURL.
     
  7. revproxy

    revproxy BANNED BANNED Jr. VIP Premium Member

    Joined:
    Nov 20, 2015
    Messages:
    396
    Likes Received:
    100
    Gender:
    Male
    1. use curl instend file_get_contents
    2. check in your machine if you got ssh access:
    curl http://wwwdotcool-proxydotnet/index.php?action=proxy-list&page=0