V
V
vitya192020-04-28 19:17:17
PHP
vitya19, 2020-04-28 19:17:17

How to send Curl requests with a time interval?

There is a script that makes a request using Curl and receives a response, I need to send such a request every 15 seconds, I wanted to use cron, but it’s impossible there for less than a minute, when using sleep(13); in a loop, the first request is sent and the rest are not

for ($i=0; $i < 4; $i++) 
 { 
 	//Тут отправляется запрос
 	sleep(13);
 }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
anikavoi, 2020-04-28
@anikavoi

// here I screwed something up, but I won't show you
So what?
Staff telepath in quarantine, sorry.
Most likely incorrect reuse of variables for curl functions, but xs.
Judging by a question, business under an Unix.
Then what... are you not using bash?
#!/bin/bash
while ( 1 )
do
php script_with_url.php
sleep 13
done;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question