1

I have created a method that I want to expose to outside world. My application is controlled by ACL. so to consume restful service you send the data in get or post to that method via url. http://mysite.com?action=this&data=this etc but I think I need to send the username and password too with it dont I? Also if I do, then where do I add it?

** WHAT HAVE I TRIED **

<?php
$ch = curl_init("http://test.local/sites/loginData");

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, 'user:password'); 
// sending username and pwd.                   
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);                          
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);                           
curl_setopt($curl, CURLOPT_USERAGENT, 'Sample Code');
curl_setopt($curl, CURLINFO_HEADER_OUT, true);

$output = curl_exec($ch);
print_r($output);      
curl_close($ch);
echo '<br><br>';
echo $output;
?> 

but it doesnt show me any response

1 Answer 1

1

If you are using http basic auth you have to configure the auth component in CakePHP properly to use that authentication mechanism.

See http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#authentication for authentication

and this http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#configuring-authorization-handlers for authorization via ACL.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.