0

I made a similar question few hours ago, but I think I asked a wrong question there. This is more exact one.

im using cURL on PHP and i want to use a site, but everytime i change my site, the browser posts a value x to server, and if you dont, you can't go to the site.

you can see that the x value changes all the time from the picture, its a FireFox Live HTTP headers addon, it shows what pages i visit with browser

From FF live HTTP headers

i looked the source code and found out what is the x value, and it comes from javascript. can i get the value with cURL or some other way from the server?

date = new Date();
    ms = (date.getHours() * 24 * 60 * 1000) + (date.getMinutes() * 60 * 1000) + (date.getSeconds() * 1000) + date.getMilliseconds();

so the main problem is that the x value changes all the time and it has to be exactly "right" value , even milliseconds must be correct. i tried finding the value myself with javascript and then putting it to php, but still does not work

2
  • Can you add your code and so we can see what you mean? Commented Feb 22, 2011 at 15:39
  • well lets say my page is www.google.com , i want to go to www.google.com/test.php .. when i press on the link the browser posts a value "x" to browser automatically as you can see from my picture right? , i think they made their site that way, but when i am using curl, then when i am using curl_setopt($ch, CURLOPT_URL, 'http://www.google.com/test.php?x=VALUE') , so this posts the x for me.do you understand what i mean, i know its very fuzzy, but i try to explain Commented Feb 22, 2011 at 15:44

2 Answers 2

0

The reason is simple, you mixed between $_POST and $_GET

Check your PHP make sure is refer/using $_GET['x']

Sign up to request clarification or add additional context in comments.

3 Comments

well lets say my page is www.google.com , i want to go to www.google.com/test.php .. when i press on the link the browser posts a value "x" to browser automatically as you can see from my picture right? , i think they made their site that way, but when i am using curl, then when i am using curl_setopt($ch, CURLOPT_URL, 'http://www.google.com/test.php?x=VALUE') , so this posts the x for me. why would i need to use GET, do you understand what i mean, i know its very fuzzy, but i try to explain
You are doing a POST request instead of GET request, is up to the targeted script to response, if the script is using $_POST['x'], how do you expect it can work?
cause it has worked before on the site, but now they added the x variable and i just need to get the right value for it
0

All that javascript is doing is calculating the current time in milliseconds on the client and sending it to the server. You can calculate such a time in php trivially with $ms = time() * 1000;

2 Comments

okay, but why I am getting different result then? my code and output PICTURE
Ok, well, read your JS code sample wrong. It's only returning the milliseconds since midnight of the current day. In PHP that would be $ms = floor(((date('H') * 24*60*60) + (date('i') * 24*60) + date('s')) * 1000 + (date('u') / 1000));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.