Note that there are some explanatory texts on larger screens.

plurals
  1. POMonitor a webpage behind authentication for a text
    primarykey
    data
    text
    <p>Here is the deal. I have a requirement to monitor certain password-protected webpage for changes and play sound alarm when size of the page is different from what I know (i.e. it was modified). Here is the chunk of code that i've come up with.</p> <pre><code>&lt;?php $e = curl_init(); curl_setopt($e, CURLOPT_URL, 'http://example.com/Account/LogOn'); curl_setopt($e, CURLOPT_POST, 1); curl_setopt($e, CURLOPT_POSTFIELDS, 'UserName=xxx@example.com&amp;Password=password'); curl_setopt($e, CURLOPT_COOKIEJAR, 'cookie.txt'); curl_setopt($e, CURLOPT_REFERER, 'http://example.com'); curl_setopt($e, CURLOPT_RETURNTRANSFER, 1); curl_exec($e); $sizevalue = 2399; do { curl_setopt($e, CURLOPT_URL, 'http://example.com/panel.php'); $content = curl_exec($e); $numberofchars = strlen($content); sleep(15); } while ($numberofchars = $sizevalue); curl_close($e); echo ' &lt;audio controls="controls" autoplay="autoplay"&gt; &lt;source src="/path/to/your/audio.mp3" type="audio/mp3"&gt; &lt;source src="/path/to/your/audio.ogg" type="audio/ogg"&gt; &lt;embed src="/path/to/your/audio.mp3"&gt; &lt;/audio&gt;'; php?&gt; </code></pre> <p><strong>Problem 1</strong>. Correct me if I am wrong, but as I understand, instead of connecting server, posting username and password only once, leaving the connection alive and using that auth key from <code>cookie.txt</code> for later actions it constantly sends the username and password to the login form for every turn of the cycle. How do I fix this?</p> <p><strong>Problem 2</strong>. I need the script to give me some temporary status because at the moment if certain condition is not met it basically turns into infinite loop and server hosting the script gives me timeout error.</p> <p><strong>Problem 3</strong>. What would be the simplest way to implement sound alarm? OGG file playback? Youtube redirection?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload