I am having the biggest issue with sending data via cURL. Below is a cURL statement that does NOT work. But has worked for other incidents in the past, with different servers.
$data = "?user=username";
$data .= "&password=123456";
$data .= "&date=2008-12-01";
$data .= "&FirstName=JOHN";
$data .= "&LastName=SMITH";
$ch = curl_init('http://www.website.asp');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_TIMEOUT, '1800');
Now, if I make this small change, by adding the data variables after the website url, it starts to work!
For example:
$data .= "&password=123456";
$data .= "&date=2008-12-01";
$data .= "&FirstName=JOHN";
$data .= "&LastName=SMITH";
$ch = curl_init('http://www.website.asp'.$data); // added $data here!
curl_setopt($ch, CURLOPT_POST, 1);
//curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_TIMEOUT, '1800');
Anyone have an idea why that is? Any insight would be handy. 🙂