Remotely accessing a php file

by 4 replies
5
On the main site the code works :

<?php
$keyword = preg_replace("/_/",' ',$_REQUEST["keyword"]);
?>

<? include_once("/keywords.php"); echo " $keyword1 "; ?>

And pull a random keyword.

Instead of loading the keywords.php file multiple times, and changing multiple times when there are additions, can I remote access the keywords.php file from another website?

Thanks
#programming #accessing #file #php #remotely
  • You can access the OUTPUT of a php file from another web site, or you can access a text or html file. The remote server won't just serve up a raw php file without processing it.

    You'll need to make sure that your hosting company has enabled allow_url_fopen
    • [ 1 ] Thanks
  • once you are certain you can access files remotely, based upon what StevenJohnson stated, take a look at these two php functions:

    PHP: file - Manual
    PHP: file_get_contents - Manual

    they both allow you to access files remotely, but one returns the file contents as a string and the other an array.

    peace
    • [ 1 ] Thanks
  • Thanks guys.

    Scott
  • you can always do a curl request to a PHP script if you have the restrictions mentioned.

Next Topics on Trending Feed