Jump to content

Sessions on Different Servers


Suchy

Recommended Posts

Since the mail function is not working on my main server I am trying to pull-off something like this to send sms:

 

Function on server where the website is

<?php
if($_POST)
{    
 $to = mysql_real_escape_string ($_POST['to']) . "@_______" ;
 $text = mysql_real_escape_string ($_POST['text']); 
 $from = mysql_real_escape_string($_POST['from']) . " writes: ";
    	  
     // add info to db - THIS WORKS
    $query = "INSERT INTO sms ....." ;
     $result = .....;
     $entriesResults = ...;	 

    $_SESSION['sms_to'] = $to;
    $_SESSION['sms_text'] = $text;
    $_SESSION['sms_from'] = $from;

?>

<iframe src ="http://www.____/sms.php" width="1" height="1" > </iframe>

<?php } ?>

 

Page sms.php on a different server

<?php
session_start;

$sms_to = $_SESSION['sms_to'];
$sms_from = $_SESSION['sms_from'];
$sms_text = $_SESSION['sms_text'];

mail($sms_to, $sms_from, $sms_text, "From: J <[email protected]>"); 
?>

 

But this is not working.

How can I fix this so that the info is passed to the server with the sms.php page

Link to comment
https://forums.phpfreaks.com/topic/55892-sessions-on-different-servers/
Share on other sites

You cannot use sessions on different servers. When you use an iframe that is a sperate instance of PHP. The PHP code is parsed on the site the iframe is serving. Not the site that has the iframe on it.

 

You will probably want to look in cURL for what you are trying to do.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.