Connecting PHP to React [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I've been learning how to use React and I already know substantial PHP. I know that I can use PHP with React since React is only the view in MVC but how do I use PHP with react locally. I have a lamp server running on my Linux machine I want to be able to run it as a backend. Like, let's say I want to make a login screen how do I connect it up. I make the front end in React and the backend in PHP. Do I have to use CORS I'd rather not since, in the end, it's going to be running on the same server.

You don't need CORS, it seems you are looking for proxy.
Just set your proxy to the listening port of your LAMP API server and then simply use fetch with absolute path from your React app.
Let's say your LAPM server is listening on port 23000
"proxy": "http://localhost:23000",
in package.json file of your React app, then
fetch("/my/api")
will call http://localhost:23000/my/api.

Related

How to run a PHP file to a server created by firebase [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I have to test my webhook response. So i create a server using firebase. but don't know how to run a php file inside that server to check my webhook response. Anyone knows?
You don't understand what firebase is, based on your question. Firebase is not a VM that hosts server side code written in a server side language like php. It is a "Platform as a service" system that lets you piece together the server using their components.
In short firebase is used in place of a server with server side code. It doesn't seem appropriate to test a web hook you have on a server.
You should just be able to use curl, or a REST testing tool like Postman or any of a gazillion different web testing tools for this.
For PHP specifically here are is a very up to date article on php based web testing tools.

Run exe file from server, render to client [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I would like to know if it's possible to run a executable file (through any technology; PHP, JS, HTML...) on the web server, and render the image on the client.
I would like to do that to not share the exe file, but just let the client see what how the programm looks like without having him to download it. Also, using that way it won't affect the client PC.
It is possible to run application on server side and display result of application to client [1]. However, if your application uses GUI it might be difficult and required complex solution.
What if you:
Display screenshots of application
Let user book some online meeting where you would present the application through skype with shared desktop
Have public server where application would be installed and user could request username/password to server and try it itself (think about security!)

How to generate real time notification system like facebook in laravel [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to create a real time notification system for my website(social network)
I'm using laravel 5.2,
I am using socket.io and redis currently,
I have created notifevent and broadcasted it succesfully, but no idea what to do ahead, can anyone please help me with it or guide me.
You should have a NodeJS and socket.io, install it on your server
When have event, use Redis to hold your variable and send it to your NodeJs or Use this PHP Library, you can send variable from PHP to NodeJS Server: http://elephant.io/
Data Processing on the NodeJs
Return it to PHP Webpage use Socket.io (client javascript) to catch this event and display for end-user (using emit and on)
You can follow this instruction with elephant.io: Using PHP with Socket.io
or that with Redis: https://github.com/laracasts/Laravel-Redis-and-Socket.io
You should try two ways and feedback with new question if you stuck because your question is unclear and very hard to answer
You can use javascript send Ajax Request and get variable from PHP and use this variable to make a socket.emit but this way is less security, you must use token or anything like this if you want to public your website

Is to possible to serve a PHP application locally in an Android app? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have created a web application and I want to serve my PHP web site on the local device. I've already connected my site to a sqlite database on my computer which can run PHP. So is there any way for installing my app acting as a kind of php server on an android device?
If you want to run PHP on your local device, first of all install one of web servers with PHP from google play:
Ulti Server: PHP, MySQL, PMA (Tested)
KSWEB: server + PHP + MySQL
PAW Server for Android
Bit Web Server (PHP,MySQL,PMA)
AndroPHP
Palapa Web Server
You can read more on this topic here: https://androidwebdev.wordpress.com/how-to-run-php-code/

monitoring Requests in php [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have a project in PHP and it works as a REStFull service, an android application constantly request some functions, I want to know, from the server side, How could I see all the petitions?
the PHP project is in a hosting.
If you are after activity log, your web server can provide that (Apache or Nginx) for example, otherwise, you will have to implement your own logging strategy in PHP (https://github.com/Seldaek/monolog can help you)
If you want to go further, you can use logstash alongside Kibana and Elastic to get you a nice representation of your service's behaviour.
https://www.elastic.co/products/logstash
If logging your Rest service is very costly in term of performance, www.gearman.org is a very good option to easily bring some asynchronousity in your application.

Categories