• Hey all-

    I’m trying to scrape a list of links that are in an unorderd list.

    Right now this is no problem, except how can I grab a random link from the unordered list?

    Even better would be if I could grab a different link every time, and never grab the same link twice.

    my code is:

    <?php 
    
    srand(time());
    $random = (rand()%15);
    
    echo wpws_get_content('SomeURL','li:eq($random)','','user_agent=Bot+at+mysite.com&on_error=error_show&');
    
    ?>

    my guess is that I can’t pass that variable to the wpws_get_content() function… but after that I’m lost.

    help?

  • The topic ‘WP Scrape Random or Ordered Selector’ is closed to new replies.