Jump to content

POSTing to forms with cURL


moon 111

Recommended Posts

I'm trying to send POST requests to a form that requires the user to be logged in. How could I do this?

 

My current code (until it hit me that I need to be logged in):

 

<?php
$ch = curl_init();

$data = array('name' => 'Foo', 'test' => 'aig');

curl_setopt($ch, CURLOPT_URL, 'http://www.kingdavidwebdesign.com/post.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

for($i = 1; $i <= 5; $i++) {
    
    curl_exec($ch);
}

?>

 

All help would be GREATLY appreciated.

 

Thanks,

- Moshe

Link to comment
https://forums.phpfreaks.com/topic/126251-posting-to-forms-with-curl/
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.