Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Everyone,

I have a question how can I get data from PHP site, which sends it to my site through POST method?

Basically i have an ASP.NET sample site, called Default.aspx. Code is below:

VB
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="lbl_name" runat="server" Text="lbl_name"></asp:Label>
        <br>
        <asp:Label ID="lbl_surname" runat="server" Text="lbl_name"></asp:Label>
    </div>
    </form>
</body>
</html>


As You can see site is very simple and has only two labels to show posted data. Now I have to show parameters "name" and "surname" in these labels.
Any ideas? :)
Posted

1 solution

1. Store every page form info in user session. you can do this by using $_SESSION PHP variable. But note that you must call session_start before using this.
$_SESSION["PAGE1"] = array (
    'var1' => 'value1', 
    'var2' => 'value3', 
    ....
);


2. You can put a hidden input in every page for and serialize data collectedfrom other pages into this hidden input. you can optionally choose base64_decode/base64_encode and json_encode/json_decode to serialize your data or you can use PHP builtin serialize/unserialize functions.
$serializedData = base64_encode ( json_encode ( $_POST ) );
$originalData = json_decode ( base64_decode ( $serializedData ) );

Hope it helps
 
Share this answer
 
Comments
szataniel 3-Oct-13 15:57pm    
I think You don't understand me. The main question is: how can I catch parameters sent through POST from PHP site on ASP.NET site? Receiving site is built in ASP.NET.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900