Remotely accessing a php file

4 replies
On the main site the code works :

$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?

#accessing #file #php #remotely
  • Profile picture of the author SteveJohnson
    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

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[3707933].message }}
  • Profile picture of the author imarketstuff
    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.

    {{ DiscussionBoard.errors[3709175].message }}
  • Profile picture of the author scotl47
    Thanks guys.

    {{ DiscussionBoard.errors[3710717].message }}
  • Profile picture of the author majick
    you can always do a curl request to a PHP script if you have the restrictions mentioned.
    {{ DiscussionBoard.errors[3904575].message }}

Trending Topics