I think, we would need cURL only for cross domain applications. I mean if I use pages stored under same domain then I should simply use POST rather than cURL.

Is this right?

Also,

For example: how do i check if username=1 and password=2 in check.php page and return TRUE or FALSE?

<?  
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, 'http://www.mysite.com/check.php'); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); 
curl_setopt(CURLOPT_USERPWD, '[username]:[password]') 

$data = curl_exec(); 
curl_close($ch); 
 ?>

Although the answer to your second question may vary depending on if you want to do cross-site processing, to post a form to another domain, just set the action field in the form like the following:

<form action='http://www.you_post_to_domain.com/index.php' method='post'>

Hope that helps answer your question.

Something like getopt("CURLOPT_USERPWD") and parse the strings delimited by :.

As you can see i have used curl_setopt(CURLOPT_USERPWD, '[username]:[password]'); in my example.

I say, what code do i write in check.php to find out what username and password received.

well, What I can think of is an ajax solution, you can make an ajax function that links to the chech.php and gives the pass and username.

In the check.php you can write: if(($user==1)&&($pass==2))
{print true;}
else
{print false;}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.