justinede Posted August 4, 2008 Share Posted August 4, 2008 Hey guys, I was making a script for my friend and he needed a way to do things with one form. I knew we could do this in the php but it turns out he needs it to submit to a pearl script then, submit to my homemade script which takes information filled out into the form and fills it into a form on the next page. I had my homemade script working fine. I just need a way to get that pearl script submitted along with my homemade one. So, is there any way to get to actions with one form? I have seen the javascript version but it dosnt work. Is there a way in PHP to execute a pearl script before my action takes place? Im not sure if this all makes sense but if it dosnt please let me know. Quote Link to comment Share on other sites More sharing options...
ratcateme Posted August 4, 2008 Share Posted August 4, 2008 can you change the perl script you could tell it to go to your script when it finishes or have it submit to your php script then you something like cURL to call the perl script at the top of your script then when that finishes run your script but all this slows down processing of the request Scott. Quote Link to comment Share on other sites More sharing options...
Third_Degree Posted August 4, 2008 Share Posted August 4, 2008 You could try posting it to the perl script with curl http://phpgfx.com/tutorials/?action=read&id=32 Quote Link to comment Share on other sites More sharing options...
Third_Degree Posted August 4, 2008 Share Posted August 4, 2008 sorry, didn't see your post ratcateme. Quote Link to comment Share on other sites More sharing options...
justinede Posted August 4, 2008 Author Share Posted August 4, 2008 i dont mind about the time, but i dont know jack shi* about pearl. In the php, once the user hits submit its supposed to go to a page with a "email=$email" in it so the email field is auto filled out with what you put into that field on page 1. The pearl just adds them to a mailing list. Quote Link to comment Share on other sites More sharing options...
ratcateme Posted August 4, 2008 Share Posted August 4, 2008 you could easily call the perl page with cURL look at the link Third_Degree posted Scott. Quote Link to comment Share on other sites More sharing options...
justinede Posted August 4, 2008 Author Share Posted August 4, 2008 i dont get any of that. can you make me the script? or tell me ehat i need to edit to make it work? Quote Link to comment Share on other sites More sharing options...
ratcateme Posted August 4, 2008 Share Posted August 4, 2008 look at the link then have a script like this <?php //curl from the link to call the perl script //your php script ?> Scott. Quote Link to comment Share on other sites More sharing options...
justinede Posted August 4, 2008 Author Share Posted August 4, 2008 ok but what do i need from that link you posted? All of it? this. <?php $ch = curl_init( ); curl_setopt( $ch, CURLOPT_URL, "http://www.google.com" ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); $response = curl_exec( $ch ); print $response; ?> or this. <?php $ch = curl_init( ); curl_setopt( $ch, CURLOPT_URL, "http://www.google.com" ); curl_setopt( $ch, CURLOPT_POST, true ); curl_setopt( $ch, CURLOPT_POSTFIELDS, "username=Third_Degree&password=youwish" ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); $response = curl_exec( $ch ); print $response; ?> they definitely look different. Quote Link to comment Share on other sites More sharing options...
ratcateme Posted August 4, 2008 Share Posted August 4, 2008 do you want to send POST data to the perl script or GET if you have get then change the url in the first example to curl_setopt( $ch, CURLOPT_URL, "http://www.perlscript?email={$email}" ); if you want POST then use the second example and change curl_setopt( $ch, CURLOPT_POSTFIELDS, "email={$email}" ); Scott. Quote Link to comment Share on other sites More sharing options...
justinede Posted August 5, 2008 Author Share Posted August 5, 2008 ok i added that to my script and it didnt work. here is my script. <?php curl_setopt( $ch, CURLOPT_URL, "http://www.aweber.com/scripts/addlead.pl" ); // Receiving variables @$from = addslashes($_POST['from']); header("Location: http://jptvjwg.com/click/?c=59065&s=31492&email=$from"); // End ?> Quote Link to comment Share on other sites More sharing options...
Third_Degree Posted August 5, 2008 Share Posted August 5, 2008 Did you read the tutorial? <?php $post = 'from='.mysql_real_escape_string($_POST['from']); //Change this to whatever the post fields are $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://www.aweber.com/scripts/addlead.pl'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_exec($ch); ?> Quote Link to comment Share on other sites More sharing options...
justinede Posted August 5, 2008 Author Share Posted August 5, 2008 lol not really. just had time to look at it. I have two fields, one is the email which is from, then there is the name and that is name. so can you plug those in? Quote Link to comment Share on other sites More sharing options...
Third_Degree Posted August 5, 2008 Share Posted August 5, 2008 <?php if(!isset($_POST['submit'])) { ?> <form action="this.php" method="post"> Email: <input type="text" name="from" /><br /> Name: <input type="text" name="name" /><br /> <input type="submit" value="submit" name="sbumit" /> </form> <?php die(); } /* Whatever YOUR script does with the form here */ $post = 'from='.mysql_real_escape_string($_POST['from']).'&name='.mysql_real_escape_string($_POST['name']); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://www.aweber.com/scripts/addlead.pl'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_exec($ch); ?> Could've tried it on your own before asking for the whole script. Quote Link to comment Share on other sites More sharing options...
justinede Posted August 5, 2008 Author Share Posted August 5, 2008 I know im sorry. thanks for this script. But since my script redirects them to a new page would i put it after the cURL stuff? Quote Link to comment Share on other sites More sharing options...
Third_Degree Posted August 5, 2008 Share Posted August 5, 2008 I'm not sure it will matter, I think the script would execute anyway despite header output, but I guess it can't hurt. Quote Link to comment Share on other sites More sharing options...
justinede Posted August 7, 2008 Author Share Posted August 7, 2008 the problem im having is that the Pearl script wants to redirect the user.. and when i try to go to the pearl script it dosnt give me the code. here is the action that Aweber is trying to use. http://www.aweber.com/scripts/addlead.pl I want to get in there and take out the part where it redirects, then ul to my server.. is it possible? or do you think they wuill have too much security. Quote Link to comment Share on other sites More sharing options...
Third_Degree Posted August 7, 2008 Share Posted August 7, 2008 where is the regular form on aweber.com that posts to that url? Quote Link to comment Share on other sites More sharing options...
justinede Posted August 7, 2008 Author Share Posted August 7, 2008 yeah oh its on a page that i made... yeah it posts to that pearl file. Quote Link to comment 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.