Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^3: Temp Webpage While Creating Final PHP Webpage

by Your Mother (Archbishop)
on Apr 15, 2020 at 19:20 UTC ( [id://11115587]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Temp Webpage While Creating Final PHP Webpage
in thread Temp Webpage While Creating Final PHP Webpage

Untested but semi-complete outline. I’m fair at this stuff but beware of cargo culting. Try to understand everything that’s going on if you’re going to use it. Any errors I make become your responsibility. :P

#!/usr/bin/env perl use strictures; use CGI ":standard"; use Date::Calc "Today"; my $pid = fork(); if ( $pid ) { hold_page(); } elsif ( $pid == 0 ) { write_php(); } else { die "Couldn't fork\n"; } exit 0; sub hold_page { print header(), start_html("OHAI"), h1("Keep panties unbunched!"), noscript("It's", (Today())[0] . ", for the love of crabcakes!" +, "Enable JS!"); print <<'_HTML_'; # <- single quote matters. <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJ +o=" crossorigin="anonymous"></script> <script> function checkPHP() { $.ajax({ url: "FILL THIS IN" ,timeout: 1000 }) .done( function( data ) { window.location.href = "FILL THIS IN"; }) .fail( function( jqXHR, textStatus, errorThrown ) { if ( textStatus === "timeout" ) { setTimeout(checkPHP, 2000); return; // Keep trying. } else if ( jqXHR.status == 404 ) { setTimeout(checkPHP, 2000); return; // Keep trying. } else { alert("WAT? " + jqXHR.status + " " + errorThrown); } }); } $(function(){ checkPHP() }); </script> _HTML_ print end_html(); } sub write_php { # Execute script that will write page # found at URL "FILL THIS IN" }

Replies are listed 'Best First'.
Re^4: Temp Webpage While Creating Final PHP Webpage
by bobinyec (Acolyte) on Apr 17, 2020 at 21:15 UTC

    Thanks - jb

Re^4: Temp Webpage While Creating Final PHP Webpage
by bobinyec (Acolyte) on Apr 18, 2020 at 11:06 UTC

    Thanks. I'll give it a look. - jb

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11115587]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-20 01:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found