Is it possible to call URL localy with CURL on apache server?
I have an apache server with limited access to public. I have set the following line in it to avoid user call file directly:
<Directory /var/www/test>
Order deny,allow
Deny from all
<Files t.php>
Order allow,deny
Allow from all
</Files>
<Files test.wsgi>
Order allow,deny
Allow from "server ip"
</Files>
</Directory>
Now I just want to call the wsgi within server with my PHP file and avoid the user to call in directly.
I tried this code in my t.php but it returns nothing (white screen with test title):
<html><head><title>test</title></head>
<body>
<script language="php">
$ch = curl_init("server ip/test.wsgi/route");
ob_start();
curl_exec($ch);
curl_close($ch);
$retrievedhtml = ob_get_contents();
ob_end_clean();
$bodyandend = stristr($retrievedhtml,"<body");
$positionendstartbodytag = strpos($bodyandend,">") + 1;
$temptofindposition=strtolower($bodyandend);
$positionendendbodytag=strpos($temptofindposition,"</body");
$grabbedbody=substr($bodyandend,
$positionendstartbodytag,
$positionendendbodytag);
print("$grabbedbody");
</script>
</body></html>