Jump to content

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 <a@abc.com>"); 
?>

 

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.