ochi Posted January 26, 2010 Share Posted January 26, 2010 hello! I'm catching what a client send with a POST form with culr, but, I don't know how to say it "wait until the form is send" because this is the only moment it can get the POST content: <?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "post.php"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_exec($ch); var_dump(curl_getinfo($ch, CURLOPT_POST)); ?> It always returns NULL, and I suppose this is the reason. Do you know where is my problem? Thank you! regards!!! Quote Link to comment https://forums.phpfreaks.com/topic/189829-culr-wait-a-response/ Share on other sites More sharing options...
RussellReal Posted January 26, 2010 Share Posted January 26, 2010 you do not get the information your user submits via a form.. with curl.. you get it with $_POST and $_GET Quote Link to comment https://forums.phpfreaks.com/topic/189829-culr-wait-a-response/#findComment-1001745 Share on other sites More sharing options...
ochi Posted January 26, 2010 Author Share Posted January 26, 2010 Hi! maybe I didn't explain well, I want to capture the POST in the other web site, not in mine, I saw that CURLOPT_POST is just for send, it is not possible do what I want? I tried this: $p = $_POST['p']; $f = $_POST['f']; In the correct web site they are perfect, but in mine, where I want to "steal" this they are empty. Thank you very much! Quote Link to comment https://forums.phpfreaks.com/topic/189829-culr-wait-a-response/#findComment-1001764 Share on other sites More sharing options...
MadTechie Posted January 26, 2010 Share Posted January 26, 2010 You need to tell cURL what to post! See curl_setopt, CURLOPT_POSTFIELDS ie $POSTData = http_build_query($_POST); curl_setopt($ch, CURLOPT_POST, $POSTData); Quote Link to comment https://forums.phpfreaks.com/topic/189829-culr-wait-a-response/#findComment-1001766 Share on other sites More sharing options...
ochi Posted January 26, 2010 Author Share Posted January 26, 2010 I'm afraid you didn't understand me, with curl_setopt($ch, CURLOPT_POST, $POSTData); I send $POSTData to the www.server/post.php , but, what I want (and I'm starting thinking it's not possible) is: In www.server/index.php I have a form, I insert whatever and push "send", redirect to www.server/post.php So, in www.server/post.php I have the post values $_POST['p'] and $_POST['f'] Now from www.othercomputer/index.php I want read $_POST['p'] and $_POST['f'] I hope you'll undestand me this time. thank you! Quote Link to comment https://forums.phpfreaks.com/topic/189829-culr-wait-a-response/#findComment-1001768 Share on other sites More sharing options...
MadTechie Posted January 26, 2010 Share Posted January 26, 2010 Yes i understood and my last reply still applies! post.php need to capture the POST and use cURL to send to another server.. however your code sends an empty post as you didn't send any post data, what my lines does is use the received post and add's it to the cURL. Quote Link to comment https://forums.phpfreaks.com/topic/189829-culr-wait-a-response/#findComment-1001781 Share on other sites More sharing options...
ochi Posted January 26, 2010 Author Share Posted January 26, 2010 Hi! thank you again, I think I forgot an important data, I can't modify anything in post.php. Regards! Quote Link to comment https://forums.phpfreaks.com/topic/189829-culr-wait-a-response/#findComment-1001793 Share on other sites More sharing options...
MadTechie Posted January 26, 2010 Share Posted January 26, 2010 Well a fuller picture is needed.. what do you have access to, whats the current process and what would you like to have happen ? Quote Link to comment https://forums.phpfreaks.com/topic/189829-culr-wait-a-response/#findComment-1001799 Share on other sites More sharing options...
ochi Posted January 26, 2010 Author Share Posted January 26, 2010 Hi again. I want to configure a router and do a log of the configuration, in my computer I access to www.othercomputer/index.php, this page have a link "configure router" this link is: <a href = 192.168.0.1 target='_blank'> Configure router </a> I open it in a new tab because I can't write a "back" button. For example, I change the wireless password, so, I write it in a form and send, I want to capture this information and add it to my log file. Did I explain it well this time? Regards Quote Link to comment https://forums.phpfreaks.com/topic/189829-culr-wait-a-response/#findComment-1001803 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.