I have to ask for help before I go insane
*********************************************
I have the following curl script (works great) which I'm trying to convert to PHP/Curl. Any pointers on what I'm doing wrong would be great.
curl -s -u usernameassword -k -F userid=username
Below is my php code that basically bombs because it says I'm not authenticated OR it doesn't understand my credentials.
<?php
$url = ' $params = "UserName=user&Password=password";
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$result=curl_exec ($ch);
curl_close ($ch);
echo("Results: <br>".$result);
?>
***********************************
Suggestions?
*********************************************
I have the following curl script (works great) which I'm trying to convert to PHP/Curl. Any pointers on what I'm doing wrong would be great.
curl -s -u usernameassword -k -F userid=username
Below is my php code that basically bombs because it says I'm not authenticated OR it doesn't understand my credentials.
<?php
$url = ' $params = "UserName=user&Password=password";
$user_agent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$result=curl_exec ($ch);
curl_close ($ch);
echo("Results: <br>".$result);
?>
***********************************
Suggestions?