0

Is it possible to get every request to server using Javascript or PHP if javascript not possible ? Thx for helping me...

  • 1
    JavaScript executes in the client browser and you won't be able to get the server requests using JavaScript. You have to use a server side technology for this. – rahul Jan 19 '10 at 14:38
  • can you ellaborate on what you mean and/or the potential use case - this is a little vague. – prodigitalson Jan 19 '10 at 14:39
  • I don't understand the question: what "request"? And "using JavaScript" ... "if JavaScript is not possible"? :-S – Pindatjuh Jan 19 '10 at 14:39
  • is the PHP going to be running on the server you want to monitor? – nstehr Jan 19 '10 at 14:39
  • Also, are you talking about every request, or do you want to track users/visits to a web page? Every request would end up including Google Bots and other crawlers, which would not be representative of how many visitors or users you have. – Richard JP Le Guen Jan 19 '10 at 14:54

2 Answers2

1

No, neither Javascript nor PHP will allow this. Your server, however, is probably already logging all requests. Apache does and I'm sure just about all other web servers do the same. You can read those log files with PHP if you need to display something from them in a web application. There are also numerous "log analysis" applications you can use to see the requests in a more graphic form.

Scott Saunders
  • 29,840
  • 14
  • 57
  • 64
  • Hmmmm... What do you think about what this website http://www.websiteoptimization.com do, Scott? We can give a url then it will give you every detail request that requested by the url. All I ask is about what that website is doing... Thx for explanation. – Riza Dwi Arifiyanto Jan 21 '10 at 14:55
  • Do you just want a list of all the images, css and javascript files that are included when you load a single page? It's easy to do that. (Though it's not my definition of "every request to [a] server.") The Firebug extension for Firefox is the best way I know. Add that extension, open it up, click on the 'Net' tab and visit a page. It will show you lots of detail about included files. – Scott Saunders Jan 21 '10 at 15:21
  • hehe... everybody know about it :) the point is i want to make my own page like websiteoptimization.com on php. i need to build my own tool. thank u so much.. – Riza Dwi Arifiyanto Jan 22 '10 at 09:39
  • Well, download the page and time it. Parse it and find any other files that should be downloaded. Then download those and time those downloads. Compare the file sizes, whatever else you need to do. You can do that in php. Look at the fopen() function. – Scott Saunders Jan 22 '10 at 14:34
0

With PHP you should be able to get all server requests with

$_REQUEST

http://us.php.net/manual/en/reserved.variables.request.php

Scott Radcliff
  • 1,501
  • 1
  • 9
  • 13