Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,539
    Thanks
    8
    Thanked 1,093 Times in 1,084 Posts

    Fun with Printable-Puzzles (Revisited)

    I like to print out the latest crossword puzzle of the day from www.printable-puzzles.com

    So, to make it quick, I made a PHP script to directly access the PDF file without going through all of their screens. This makes it really easy to print out the puzzle each morning with the execution of one script.

    I had posted this a year or so ago and since then, they recently did a new layout on their web page. That messed-up my HTML parsing. So below is the new PHP script to once again access today's puzzle.

    Enjoy ...

    PHP Code:
    <?php  
    // Printable Crossword Puzzles -  
     
    $the_url "http://www.printable-puzzles.com/printable-crossword-puzzles.php";

    $curl curl_init(); 
    curl_setopt($curlCURLOPT_URL,"$the_url");
    curl_setopt($curlCURLOPT_HEADER0); 
    curl_setopt($curlCURLOPT_RETURNTRANSFER1); 
    curl_setopt($curlCURLOPT_CONNECTTIMEOUT0); 

    $data curl_exec($curl);
    curl_close($curl); 

    // GRAB THE NEWEST CROSSWORD PUZZLE
    $cross_pos strpos($data"Crossword  Puzzle  #"); // they put two spaces in between
    $cross_code substr($data$cross_pos+206); 
    $cross_url="http://www.printable-puzzles.com/dl.php?".$cross_code.".pdf";

    header("location: $cross_url");

    ?>


    .

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    :O
    Wrong forum
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •