Need to access REST api from php using cURL. This i a rest link:
http://username:password@172.16.59.225:8042/tools/find -d '{"Level":"Study","Expand":false,"Query":{"StudyDate":"20191226-20200324"}}'
as you see a lot of " and white space.
I have tried to prepare string manually like this:
$url = "http://172.16.59.225/tools/find -d '{\"Level\":\"Study\",\"Expand\":false,\"Query\":{\"StudyDate\":\"20191226-20200324\"}}'";
and pass password using: curl_setopt($ch, CURLOPT_USERPWD, "username:password");
I have used urlencode()
and curl_escape
and nothing works. At the same time, this link works perfectly by using it with curl in Linux cmd.
Is it doable?