Develop PHP Website for Learning Web Design Free Online
  Home   |   Forums   |   DevCMS
  Join   |   Log In
 
   

PHP Tutorials - Learn PHP

Tutor at Develop PHP
Communicate Between Two Servers Using PHP Includes
By: Adam      Created: Jul 15, 2009      Views: 2004 Tweet This Page  Post page to Facebook  Post page to Facebook

Using the include or require statements we can also perform cross domain scripting from one server, to a completely different server. This comes in handy when you are looking to create PHP processing scripts and engines that nobody can view the source to but you. It remains on your server but you can allow other sites to connect to it. Maybe even for a fee if the application performs some cool task that helps people's business.

Here is an example of placing a full URL to perform PHP scripting between two servers.
Learn HTML
<?php 
// include a script into another script from another server
include "http://www.yourwebsite.com/yourScript.php";
?>

And here is an example of sending variables through the URL string to the script waiting to be included. That script can then process and return values and information according to those variables.
Learn HTML
<?php 
// include a script into a caller script from another server, and send variables
include "http://www.yourwebsite.com/yourScript.php?name=John&pin=8558";
?>

Since the include, require, require_once, and include_once statements all work in a similar way, all four could be used to script from one server to another using PHP. Here are alternate ways of writing the inclusion.
Learn HTML
<?php 
include "http://www.yourwebsite.com/yourScript.php?name=John&pin=8558";
include_once 
"http://www.yourwebsite.com/yourScript.php?name=John&pin=8558";
require 
"http://www.yourwebsite.com/yourScript.php?name=John&pin=8558";
require_once 
"http://www.yourwebsite.com/yourScript.php?name=John&pin=8558";

// Or you may see them wrapped in parenthesis like this:
include ("http://www.yourwebsite.com/yourScript.php?name=John&pin=8558");
// Which is not required but will also not break the script
// include and require are not functions, they are language constructs
// so the parenthesis are not needed at all at this time
?>



                                   File Paths and Directory Script Navigation


Comment on Communicate Between Two Servers Using PHP Includes




Search Tags:
Communicate   ·  Between   ·  Two   ·  Servers   ·  Using   ·  PHP   ·  Includes   ·  
 
 
Arbitrary Links and Archives
Home
Active Forums
Members
SIte News
Link To Us
Gear
2009 Forum Archive
Programming Courses
Learn HTML
Learn CSS
Learn PHP
Learn MySQL
Learn Javascript
Learn jQuery
Learn ActionScript 3.0
Learn Java
Learn XML
DevelopPHP Requires Flash Player
Get Adobe Flash player
___________________________________________

Terms of Use  •  Privacy  •  Admin Notes

©2010 developphp.com   |   Powered By FlashBuildingHolder