I would like to know how can I access or read the array from another php.

I mean that I am working on a .php page which contains the array and I want to display the content of that array but on another .php page.

for example I used the following method in a .php file and I want to get the content of the array in another .php file. what is the method that is going to receive the array's content in the second page?

<?php

$r= new HttpRequest('http://localhost/sameh.php', HttpRequest::METH_POST);
$r->addPostFields ( array ( "n" => 'welcome to our server')) ;
$r->send ();

?>

* This code is in the first page but I don't know what to write to receive it on the second one. so what is the method that can help me with this?

Recommended Answers

All 4 Replies

If you want to pass the array to another module, make it a session variable. That way it remains available to all modules as long as the session is alive.

store the array in one variable
e.g.

$a = array(array()array());

Maybe my question was not that clear and sorry about that ,, I want to find a way to access the array that is defined inside the HttpRequest() class on another page. So that the array "n" that include value "heba" will be displayed on another.php page. this is what make me thinking that the problem is on how to access the content of the array on the second page.


I tried the session and It sends the array to another page ,, but when I tested with the httpRequest() method it doesn't send the content of the array "heba" to the second page.

Thanks for your help.

Member Avatar for diafol

How about

echo $_POST['n']; //to print out the data
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.