1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Under same domain but different server

Discussion in 'PHP' started by poyor7, Jul 12, 2006.

  1. #1
    Hi,

    I would like to know:

    Scenario :
    I've two server different OS A:linux and B:NT under same external domain.I've something that from A to be retrieve by B.
    Example:
    I've a form let say i name it writeppt.php and in the form something like this
    Snippet:
    File from Server B,
    
    <?
    session_start();
    if(   (!isset($_SESSION['userid'])) || (!isset($_SESSION['pass'])) ) {
    	include_once("log.php");
    	exit;
    }
    //<!-- start declare variables -->
    include ("csv_crampler.inc.php");
    [b]$csv = new csv_handler("../apply.csv")[/b]
    
    PHP:
    So, my question is the file in include syntax apply.csv is in Server A so how do i map the path so it can be
    retrieve?

    Regards
    poyor7
     
    poyor7, Jul 12, 2006 IP
  2. acplus

    acplus Guest

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    There are two ways of doing this. You could open up an Internet connection through using fopen or file to retrieve the file through using a URL, or you could use the PHP FTP module for connecting through FTP and downloading the file.

    Your best bet is to use something like:

    //get file contents
    $file_contents = file("http://domain/apply.csv");

    //write file contents
    file_puts_content("../apply.csv", $file_contents);

    //use your CSV API
    $csv = new csv_handler("../apply.csv")

    Hope this helps.

    Regards,
    acplus
     
    acplus, Jul 15, 2006 IP