Jump to content

opening a page from "behind the scene"


zang8027

Recommended Posts

I got paypal sending back information to my site "behind the scene" (never opens up the page.. user never sees it happen) and that voids any session or cookies that I am using.

 

Any way I can open a page once this page is hit? Once an order is complete, it sends to paypal_ipn.php

 

 

Once it hits that page.. can i have another page from my site open up? May be javascript... not sure

Link to comment
https://forums.phpfreaks.com/topic/145018-opening-a-page-from-behind-the-scene/
Share on other sites

generally that page is made as back ground on purpose as it is not fixe "when" paypal will hit it back.

 

it has to be an asychronous activity. You can update database when this page is hit by paypal.

 

Then you can open up pages and show status depending upon data in the database.

That "behind the scene" technology you need is AJAX. You just send an AJAX request with all needed data (through GET or POST method) and your "behind the scene" php script will do all the work and return respond to browser.

 

If i understand what you are trying to say...

hmm see this is the page PAYPAL hits once the payment is complete:

 

 

<?php
session_start();


//We need to first grab the information being passed from paypal
$date = $_REQUEST['payment_date'];
$cost = $_REQUEST['mc_gross'];




	$myFile = "./payments.log";
	$fh = fopen($myFile, 'a') or die("Cannot Connect to Log");

	$v = "This was sent over: Order costs:$cost on $date \n";

	fwrite($fh, $v);
	fclose($fh);


?>

 

i have sessions for restaurant and user but since this is happening behind scenes.. then the session voids like i said..  so how can i add this stuff to DB and know which to pull out?

you will have to store all that information in database and pass the unique id of that (say order_id) to paypal ipn URL like

 

 

paypal_ipn.php?order_id=12345

 

so when paypal hits back this page, you can retrieve all information you want from database do your stuff and update database back..

 

 

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.