2

I need to access the PHP internal representation of the $_GET and $_POST arrays inside of my function for a particular page request. Is there a PHP internal representation of these arrays? Like for example $_GLOBAL is a representation of the internal array EG[Symbol_Table]. Otherwise is there any way to identify and access the GET and POST variables inside the symbol table and extract them?

In short I need all the variables that I would get from the $_POST and $_GET arrays but inside the Zend Engine. I am developing an extension that has a function with the format (input parameters, page) where the input parameters are all the variables declared by the php page. Is there any way to access this?

3
  • I'm not sure if I understand the question, but have you tried print_r()? eg. print_r($_POST) will print everything inside that object/array Commented Aug 12, 2011 at 0:12
  • Are you writing this in C? Might be best if you specify exactly what you're doing as people are obviously getting confused. Commented Aug 12, 2011 at 0:19
  • Thanks...I added some more info in the answers below. Commented Aug 12, 2011 at 0:55

2 Answers 2

4

They're PG(http_globals)[TRACK_VARS_GET] and PG(http_globals)[TRACK_VARS_POST] respectively.

Sign up to request clarification or add additional context in comments.

7 Comments

Yes I am writing the extension in C inside the zend engine. Heres the overview of what I need to do. I need to access all the variables declared inside a single php page request and send those along with the page name to another function that does some processing on the input parameters.
@user890928 Ok, well there's six elements in http_globals and you should find everything you need in there. Each one is an array zval.
Will those give me access to the get and post variables inside C inside a particular page? Also is there any way to restrict these variables to a single page request? I mean get only the variables from a single page and not others?
Sorry my network timed out and I posted an old reply after your most recent one. Thanks for the help...i'll look up that array.
@user890928 Yes they only represent a single page request.
|
0

In the newer version (I assume after 5.3), you have to use stream "php://input" to access GET or POST data.

You can look into the implementation of file_get_contents function in php to see how to open and read a stream.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.