Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use PHP script for "click" on link

Tags:

http

php

I am solving an issue that I cannot figure out. I need to login and click repeteadly (thousand of times) on the specific link to create some load. I know I should use HTTP/PHP for that but do not know how to solve the login? My next idea was to use some packet sniffer and re-send the requests..but will it work when I would close the browser? Thanks

like image 820
Petr Avatar asked Apr 10 '26 14:04

Petr


2 Answers

If you'd want to do this from a PHP script, you could use cURL to simulate the HTTP request. However, it is easier to use a benchmark tool like ab or siege to put load on certain URLs

With ab:

ab -n 1000 -c 10 http://www.example.com/login.php

From the Siege website:

Siege is a regression test and benchmark utility. It can stress test a single URL with a user defined number of simulated users, or it can read many URLs into memory and stress them simultaneously. The program reports the total number of hits recorded, bytes transferred, response time, concurrency, and return status. Siege supports HTTP/1.0 and 1.1 protocols, GET and POST directives, cookies, transaction logging, and basic authentication. Its features are configurable on a per user basis.

Also see this related question

like image 185
Gordon Avatar answered Apr 12 '26 03:04

Gordon


Take a look at Selenium. You may record an action and then edit the resulting script into a loop.

like image 41
djn Avatar answered Apr 12 '26 03:04

djn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!