SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Threaded View

  1. #1
    SitePoint Wizard ryanhellyer's Avatar
    Join Date
    Oct 2006
    New Zealand
    0 Post(s)
    0 Thread(s)

    Processing data on other servers

    Due to reasons outlined here, I'm trying to transfer data between servers without using the URL. Below are the scripts I'm using to do this. The test.php is the one run in the browser, it adds a form which when submitted sends the results to an external script on another server. The index.php file processes the data. The data.php file provides the data for use by the original server and the style.php file provides CSS data which creates coloured blocks based on hex colour codes submitted by the form.

    My intention was to grab the processed results via the readfile() function. Unfortunately the session variables I placed the resulting data into are not read by the readfile() function, presumably because the server the test.php file is on is trying to access the data and not the users browser. I was hoping javascript might have the answer, but from another topic I posted this seems to be not possible

    Do any of you know how I can get around this problem?

    Code http://localhost/test/test.php:
    	// Start reading function
    	$data = ob_get_contents();
    	$data_exploded = explode("|", $data);
    	// Adds data to variable
    	$coloura = $data_exploded[0];
    	$colourb = $data_exploded[10];
    	$colourc = $data_exploded[2];
    	// Beginning of the HTML
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    <head profile="">
    	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    	<link rel="stylesheet" href="" media="screen" />
    <div id="coloura"></div>
    <div id="colourb"></div>
    <div id="colourc"></div>
    <form action="" method="post">
    Colour A: <input name="coloura" type="text" value="<?php echo $coloura; ?>" />
    Colour B: <input name="colourb" type="text" value="<?php echo $colourb; ?>" />
    Colour C: <input name="colourc" type="text" value="<?php echo $colourc; ?>" />
    <input type="submit" />

    	$_SESSION['coloura'] = $_POST['coloura'];
    	$_SESSION['colourb'] = $_POST['colourb'];
    	$_SESSION['colourc'] = $_POST['colourc'];
    	Header( "HTTP/1.1 301 Moved Permanently" );
    	Header( "Location: http://'.$_REQUEST['return_url'].'" );

    	header('Content-type: text/css');
    	echo '
    	div {float:left;width:100px;height:100px;border:1px solid #666;}
    	div#coloura {background:#' . $_SESSION['coloura'] .'}
    	div#colourb {background:#' . $_SESSION['colourb'] .'}
    	div#colourc {background:#' . $_SESSION['colourc'] .'}

    	echo $_SESSION['coloura'].'|'.$_SESSION['colourb'].'|'.$_SESSION['colourc'].'|';
    Last edited by ryanhellyer; Apr 19, 2009 at 03:11.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts