Jump to content

enoyhs

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Posts posted by enoyhs

  1. Daniel0: I'm not sure about this...

    For example take a look at big pages which have lot of content.

    When you load page content is showing up while you are loading. Not sure if it is php (maybe it is another so I may be mistaking here), but I'm pretty sure that I have seen php pages give out content while it is still loading...

     

    Or am I missing something here?

  2. After several testing I got bad results:

    Using cURL only got me around 20 records in 30 seconds. So changed max_execution_time in php.ini and got a bit better result ~1000 results in 6 minutes was max.

     

    Could anyone give some advices how to speed up things?

     

    I will explain a bit further what I'm trying to do. I got website which has many entries around 3.000 and they look like this:

    http://www.website.com/result.php?result=1

    So I used for loop to loop trough various pages (changing result value).

    My goal: To find all valid results.

    For example if result doesn't exist in database it returns page with text: "Invalid page" (though all page formatting is kept). But if page exist for most of pages they are very long so I think this really slows down my gathering.

    But actually I only need a top of page from valid pages so is there way to limit how much bytes I need to receive to speed up things?

     

    I hope I made myself clear.

  3. echo "<form>";

    echo "<fieldset>";

    echo "<label>";

    echo "<span>Title:</span>";

    echo "<span class='price'><input name='title' type='text' id='title' value='" . $_SESSION['firstname'] . "' size='24' />";

    echo "</span>";

    echo "</fieldset>";

    echo "</form>";

     

    Of course to make it much simpler you could have written this like this:

    <form>
    <fieldset>
    <label>
    <span>Title:</span>
    <span class="price"><input name="title" type="text" id="title" value="<? echo $_SESSION['firstname']?>" size="24" />
    </span>
    </fieldset>
    </form>

     

    In php everything must not be echoed. Everything that you want tot put out in php tags though must be. So simply use php tags only when you need them.

  4. I quite didn't understand your question...

     

    What I mean with function call is you need to call function like this: version_check();

     

    So the full code would be:

    <?php
    function version_check()
    {
    $template_version = '2.5';
    if (ini_get("allow_url_fopen") == 1) {
    	$lastest_version = @file_get_contents("http://www.jaredritchey.com/downloads/601.txt");
    	$check = version_compare($template_version, $lastest_version, ">=");
    }	
    echo($latest_version);
    }
    ?>
    version_check();

  5. Hm...

     

    Not what I meant but that is good idea too...

    But with your approach I would need a way to store all previously outputted data so I can see it at end. What would you suggest for that? I think just change method to POST and recognize steps by ifs..

  6. Hm...

    I'm currently testing "stream_get_contents" I will let you know.

     

    So after Daniel0's answer here is my next question:

    Is it possible to execute part of code and see result and then continue next step?

    For example I will give for cycle:

    <?php
    for ($i=1; $i<=10; $i++) {
      // Do some stuff.
      // Currently halt script to print out current results.
      // Continue with script.
    }
    ?>

    Just to clarify: I'm using W.A.M.P. on Windows Vista and I will firefox for outputting result.

     

    My idea would be to execute some code, output it and then refresh page (with headers or how ever you could refresh it after specified time) and continue script from last place. Or is there better way?

  7. Yes. It will give you one of rows (tables) to order by so you will have a chance of getting specific result in 1/count($arr) times.

     

    But I think better way to pick random would be by randoming id number and then picking specific id. If there are missing id just pick one closest...

     

    PS. Oh... Didn't know that GingerRobot. Ok so my statement isn't correct I suppose.

  8. First error I see is:

    if ($promoused=="USED" && $siddate==$today) {

    $promotion = $promoid;

    $result2 = mysql_query("SELECT id from promotions WHERE id='$promotion' Order by id") or die(mysql_error());

    $row = mysql_fetch_array( $result2 ) or die(mysql_error());

    } else {

    $result2 = mysql_fetch_row(mysql_query("select * from promotions WHERE used='n' order by rand() limit 1"));

    52. $row = mysql_fetch_array( $result2 ) or die(mysql_error());

    }

    $title = $row['title'];

     

    Second error from your message is:

    You can't order rand(). You have to order by one of rows. So one of the ways is write all rows in array and then $arr[rand()].

    Something like this:

    $arr[0]='row1';
    $arr[1]='row2';
    $arr[2]='row3';
    $arr[3]='row4';
    // And so on...
    $result2 = mysql_fetch_row(mysql_query("select * from promotions WHERE used='n' order by " . $arr[rand(0,count($arr)) . " limit 1"));
    

  9. Hi!

    I would like to know what is fastest way to read contents of web page?

    I would like to know what possibilities are there.

    Currently with "file_get_contents()" reads around 10-13 pages in 30 seconds (Default max execution time). I know I can change max execution time so it can read more pages but I would like to find another way if it is possible...

     

    Also I would like to know is it possible to print out the results while still loading page? Maybe it is browser(my settings), php setup or script fault so I'm not sure...

     

    If code is needed I will offer it after asked.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.