Guest php newb Posted October 3, 2005 Share Posted October 3, 2005 I couldn't find this in the w3schools php tutorial so I am going to ask.Is there a way that once someone submits a form I can have it sent to an email, but then post it on another page as well using php. I know how to do it in asp, but I need to do it in asp. Link to comment Share on other sites More sharing options...
actionsketch Posted October 4, 2005 Share Posted October 4, 2005 I'm actually not sure how to manually post to another page in PHP, if possible, but you can send with get. header("location: whatever.php?variable=blah&msg=email sent!");that will redirect the page to where ever you want assuming you havnt already set header information. If you have, then (as far as I know) you have to redirect using javascript. Link to comment Share on other sites More sharing options...
alzable Posted October 4, 2005 Share Posted October 4, 2005 Yes, in fact, there is another post in this forum about what you want. Link to comment Share on other sites More sharing options...
punkstar Posted October 9, 2005 Share Posted October 9, 2005 You can actually post to another page by using a php lib called curl, or libcurl.There isn't that much documentation around, and I am a little rusty on it, but ill give it a go <?php$ch = curl_init();//set the optscurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);curl_setopt($ch, CURLOPT_URL,"http://www.yourwebsite.com/postcatch.php");curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, "var1=var1value&var2=var2value");//result$result = curl_exec($ch);curl_close($ch);?> ..now that will actually post the variables over to the page that you set in CURLOPT_URL. There is somemore cool stuff that you can do with curl like letting curl handle its own cookies, dealing with useragents, etc. Once you master curl, you can make a bot for anything or, like you, use it to make post requests on your behalf.There are ofcourse other ways to do it, i believe you can actually do it wish fsockopen()? But do not have much experience with that function.Hope that helps Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now