Brandon,
I was told of a better way of sending POSTs without using cURL and it allows
usernames and passwords to be used...
// Format of $authorization is username:password (for password protected
directories)
// Code can be easily modified to add input parameters for User-Agent,
Referer,
Cookie, Accept-Encoding or other required headers
function HTTPPost($host, $path, $dataToSend, $port = 80, $authorization =
"")
{
if(!($fp = fsockopen($host, $port)))
{
return "<b>From HTTPPost()</b><br>\n<b>Error:</b> Error opening
network
socket.<br>\n";
}
socket_set_blocking($fp, TRUE);
fwrite($fp, "POST $path HTTP/1.0\r\n");
if($authorization != "") fwrite($fp, "Authorization: Basic " .
base64_encode($authorization) . "\r\n");
fwrite($fp, "Host: $host\r\n");
fwrite($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fwrite($fp, "Content-length: " . strlen($dataToSend) . "\r\n\r\n");
fwrite($fp, $dataToSend);
for($result = ""; !feof($fp); $result .= fread($fp, 1000000));
fclose($fp);
return $result;
}
Many thanks to Brad Jackson who provided this code to me.
Marc.
"Brandon Orther" <[EMAIL PROTECTED]> wrote in message
008901c125ab$f0242320$5a52a040@webintel">news:008901c125ab$f0242320$5a52a040@webintel...
Hello,
Using cURL:
I have been working for some time to get my PHP program to login to an
https site and now that it logs in I can't figure out how to do a post
to the site while I am logged in. After I use curl to login I do
another curl session to try and emulate a form post. But when I get the
results it is just the login page. Does anyone know how after my script
logs in to a site I can run another curl post while I am logged in?
Thank you,
--------------------------------------------
Brandon Orther
WebIntellects Design/Development Manager
[EMAIL PROTECTED]
800-994-6364
www.webintellects.com
--------------------------------------------
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]