Bu bir PHP komut dosyası çalıştırmak ve sonuç servis edilir önce başka birinde sonucu dahil etmek mümkün mü?

0 Cevap php

I have a php script http://example.com/myapp/myscript.php running on an Apache server. I call this URL from a mobile app, the script does its logic, then set HTTP headers and body with data as a JSON string ( that the mobile app later parses and handles ).
Now I would like to have an URL http://example/myapp/mypage.php that would retrieve the data returned by myscript.php, lay it out with html and serve the page.
I achieve the result by first serving the page empty, myscript.php is then called via Ajax and the layout is done client-side with the Ajax response, but I wonder if it is possible to do this in only one http request :
1/ call mypage.php that would call and execute myscript.php on the server side
2/ retrieve the JSON data in mypage.php, parse it and lay it out on the server side
3/ serve the page

PHP sadece kod içerecek şekilde ilk önce yürütme olmadan, çalışmaz içerir.

Teşekkür ederim.

0 Cevap