S
S
Sergei Chugainov2019-08-12 15:33:53
PHP
Sergei Chugainov, 2019-08-12 15:33:53

Is it possible to get a response in one class instance and work with a previously received response in another?

Hi all! I study php for my own development and set myself the task of making an elementary parser. I know that there are many ready-made parsers in the public domain, but I want to figure it out myself.
The class is elementary, a request is sent and a response is received.
Please just explain the principle! For example, I will outline what interests me.
On one page I create an instance of the class (No. 1), in it I send a request and receive a response. And let's say on another page in instance (#2) can I work with the response received in instance (#1) on another page. Is it really possible to do this?
If possible, explain on your fingers how this is done or advise literature in Russian if possible.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Adamos, 2019-08-12
@Adamos

On the fingers: when you open a PHP page, the web server allocates memory and runs your script in it. When you open another page, another memory is allocated. There is no interaction "on the fly" between them and cannot be.

C
crazywu, 2019-08-12
@crazywu

Regarding the title of the question:
Even if you succeed (in php it is unlikely) - this is a disgusting practice.
This is done through cookies, ideally it would be worth knowing js at a basic level before getting there, but in general, look here
https://www.php.net/manual/ru/reserved.variables.c...

G
Grigory Vasilkov, 2019-08-12
@gzhegow

The first script is run on the server and the second one is run there. What is common on the server? HDD. Put the answer in a file, then read the file.
If you need to build on the previous answer - you can make a multicurl (then it will be on one page, but wait longer) - you say first make requests there and there at the same time, and when they all end, do more

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question