Re: Include function across servers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ioannes wrote:
I have a particular business application so just returning html is OK, the output is the useful bit in this case. I understand from the discussion that I can still run my code on my server in response to a remote server requesting the result of a function in that file and that result gets back to that server. So you can use include() to access the result of a function on another server, sounds like.

You can include code, but you can't run a function from another server.

That code could include a function but that doesn't mean you'll get the right results from it.

For example:

<?php

mysql_connect(....);

function get_categories()
{
  $return = array();
  $query = "select * from categories";
  $result = mysql_query($query) or die("problem: " . mysql_error());
  while ($row = mysql_fetch_assoc($result)) {
    $return[] = $row;
  }
  return $return;
}

?>


including that from a remote server will query your local database - it will not query your remote database.

So I really suggest finding another way to do whatever you are trying to do...

1) for security reasons (you don't want anyone else to be able to access your database or anything else because if you can do it, so can I - plus a lot of other things to get into your server)

2) for practicality reasons (eg the above)

3) for usability reasons (eg the remote server crashes, your website/whatever is inaccessible because functionality can't be retrieved)

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux