Views: 44445
I need to Call a MEAN stack app into an Apache server,
Here is how I might call the mean app. I am designing a platform that divides a monolith app into micro-services with high availability.
To the URL first set the PHP resource:
$ch = curl_init();
direct example: CURL_EXEC:
<?php // create a new cURL resource $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, "http://www.example.com/"); curl_setopt($ch, CURLOPT_HEADER, 0); // grab URL and pass it to the browser curl_exec($ch); // close cURL resource, and free up system resources curl_close($ch); ?>
header("Location:www.google.com");
$page = file_get_contents("http://www.domain.com/filename");
This does require FOpen which some web hosts disable and some web hosts will allow FOpen, but not allow access to external files. You may want to check where you are going to run the script to see if you have access to External FOpen. You can also use
file_get_contents
to access REST APIs:$payload = file_get_contents('http://api.someservice.com/SomeMethod?param=value');
Or if you just want a simple URL GET then:
$lines = file('http://www.example.com/');