I need to translate this cURL command into PHP cURL code:
curl -v -b session_cookies.txt -L -H "Content-Type: application/x-www-form-urlencoded" -v -d '[email protected]&j_password=site1' "https://login.uat.site.be/openid/login.do"
I have tried this, but it doesn't seem to work, I kept getting empty as my result:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://login.uat.site.be/openid/login.do");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "[email protected]&j_password=site1");
curl_setopt($ch, CURLOPT_POST, 1);
$headers = array();
$headers[] = "Content-Type: application/x-www-form-urlencoded";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_COOKIEJAR, public_path().'/session_cookies.txt');
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
dd($result); I kept getting empty string, however it works in the standard curl command.
curl_setopt($ch, CURLOPT_VERBOSE, TRUE);.login.uat.site.bethe real address? It says "* Could not resolve host: login.uat.site.be" for me.