Jump to content

cURL, how do I use it and will it work?


unplugged_web

Recommended Posts

I'm trying to write a curl function that will take the the information (name and number) from a form and send them to a remote url then send the user to the next page. I've never used curl before so would be grateful for any help that you can give.From my understanding I would need something like

<?php$name = strval($_GET['name']);$number = substr($_GET['number'],1);$ch = curl_init();curl_setopt($ch, CURLOPT_URL,"http://www.remoteurl.com/results.php?password=1234&name=$name&number=44$number");curl_setopt($ch, CURLOPT_GET, 1);curl_setopt($ch, CURLOPT_GETFIELDS);//result$result = curl_exec($ch);curl_close($ch);?>

The form looks like this:

<form action="" method="get" name="user" id="user" onSubmit="MM_validateForm('number','','RisNum');return document.MM_returnValue">Please your name.	  <br>	    <br><label>  <br />  <label>Name  <input type="text" name="name" id="name" />  </label>  <br /><label>Number<input type="text" name="number" id="number" />  </label>  <br /><input name="submit" type="submit" />  </form>

but how do I incorporate the curl into the form and then send the user to the next page?Thanks

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...