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.
// Printable Crossword Puzzles -
$the_url = "http://www.printable-puzzles.com/printable-crossword-puzzles.php";
$curl = curl_init();
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
$data = curl_exec($curl);
// GRAB THE NEWEST CROSSWORD PUZZLE
$cross_pos = strpos($data, "Crossword Puzzle #"); // they put two spaces in between
$cross_code = substr($data, $cross_pos+20, 6);