K
K
kitaisc2014-11-21 22:14:05
PHP
kitaisc, 2014-11-21 22:14:05

How to execute script on curl output?

People, help with solving the problem:
There is a certain script on a remote site: example.com/script.php
By executing it with the #curl example.com/script.php command, I get a certain array of data.
How to make it so that if this array contains a certain sequence of characters, for example "Privet Vasya!", a console command in bash is executed?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Entelis, 2014-11-21
@DmitriyEntelis

php.net/manual/en/function.exec.php

V
Vlad Zhivotnev, 2014-11-21
@inkvizitor68sl

curl example.com/script.php | grep -q 'Hello Vasya!' && somecommand
This is in its simplest form.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question