post method example

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ltcabral
Forum Newbie
Posts: 2
Joined: Thu Mar 27, 2008 8:28 am

post method example

Post by ltcabral »

Hello,
im learning about post method and im having some problemas... could anyone post here a simple php code that would receive an specific post and return a XML file? (the part that send the post is done, i did it in C, but not the part to receive) its enough for me to understand how to use it in other ways (the tutorials i read didnt help enough...)
thx
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Re: post method example

Post by timvw »

The following code would accept posted xml data and save it in $data:

Code: Select all

 
$data = file_get_contents(‘php://input’);
 
ltcabral
Forum Newbie
Posts: 2
Joined: Thu Mar 27, 2008 8:28 am

Re: post method example

Post by ltcabral »

hm... actually i will send a string, and i want it to return the xml...

the post i must send is something like

"$POST[in_chktest] => xxx"
and i want it to check it and return diferent XML according to xxx

im using C funcions from libcurl library which will automaticaly get the result
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "$POST[in_chktest] => test");
result = curl_easy_perform(curl);
Post Reply