Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript value to PHP, cURL
    text
    copied!<p><strong>UPDATE2:</strong></p> <p>i tried this piece of code, but still no echo, i valued my cookie to 3 for just test</p> <pre><code> &lt;?php ?&gt; &lt;script type="text/javascript"&gt; date = new Date(); ms = (date.getHours() * 24 * 60 * 1000) + (date.getMinutes() * 60 * 1000) + (date.getSeconds() * 1000) + date.getMilliseconds(); alert(ms); document.cookie += 'test=3'; &lt;/script&gt; &lt;?php echo $_COOKIE['test']; ?&gt; </code></pre> <p><strong>UPDATE1:</strong></p> <p>i tried this: did i do it right? it did not echo anything.</p> <pre><code>&lt;?php ?&gt; &lt;script type="text/javascript"&gt; date = new Date(); ms = (date.getHours() * 24 * 60 * 1000) + (date.getMinutes() * 60 * 1000) + (date.getSeconds() * 1000) + date.getMilliseconds(); $.get("test.php", { test: ms } ); &lt;/script&gt; &lt;?php echo $test; ?&gt; </code></pre> <p><strong>ORIGINAL POST:</strong></p> <p>well basically i'm on a site with cURL, but everytime i want to change the location where i am, i need to post an extra variable <code>ms</code> to the site..so for example</p> <p><code>POST /chat.php?cg=0&amp;ms=23585666</code></p> <p>the ms value comes from javascript, but how i get the value to my PHP code to send it out with cURL post?</p> <pre><code>&lt;script type="text/javascript"&gt; date = new Date(); ms = (date.getHours() * 24 * 60 * 1000) + (date.getMinutes() * 60 * 1000) + (date.getSeconds() * 1000) + date.getMilliseconds(); &lt;/script&gt; </code></pre> <p>so eventually it goes to my cURL postfields</p> <pre><code>$data = array('ms' =&gt; $VARIABLE_MS_FROM_JAVASCRIPT, 'cg' =&gt; 0); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); </code></pre>
 

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