Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

lwp::useragent equiv in php? 1

Status
Not open for further replies.

esromneb

Programmer
Mar 30, 2002
76
US
Hi, I'm looking for a way to make http requests (and send form submits) with php. In cgi I would use lwp::useragent, what's the php equiv? I found some php that will alow me to make requests, but so far I haven't been able to submit forms. Thanks.
-ben
 
<form action=&quot;insert.php&quot; method=&quot;post&quot;>
First Name: <input type=&quot;text&quot; name=&quot;first&quot;><br>
<input type=&quot;Submit&quot;>
</form>
<?
<?
$first=$_POST[&quot;first&quot;]:

$username=&quot;username&quot;;
$password=&quot;password&quot;;
$database=&quot;your_database&quot;;

mysql_connect(localhost,$username,$password);
@mysql_select_db(&quot;database name&quot;) or die( &quot;Unable to select database&quot;);

$query = &quot;INSERT INTO contacts VALUES ('$first')&quot;;
mysql_query($query);

mysql_close();
?>
 
I do believe that's the way to use LWP::UserAgent in php. Well not the same thing, but whatever. Ok thanks for the help br0.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top