hi, I was working on a project and can't seem to find any help on the web. I need to connect to a server with POST and use the returned data in the script. The server is HTTPS also. I've read that cURL should be able to do it, but everything I've tried won't work. Any help would be greatly appreciated.
your problem is not not much clear what you are really trying to do can you please post your script so that we can test them ?
Create a simple host file to call with the information. i.e: // host.php if (isset($_POST['conn'])) { $host = $_POST['host']; $user = $_POST['user']; $pass = $_POST['pass']; $db = $_POST['db']; // run few simple checks and mysql connect $return = 'return data'; // return whatever data you want. die($return); } // client.php if (true) { // check if form is submitted $fields = array( 'host' => 'localhost', 'user' => 'db_user', 'pass' => 'pass', 'db' => 'db_name' ); $fstr = ''; foreach($fields as $k=>$v) $fstr .= $k . '=' . $v . '&'; rtrim($fstr, '&'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'http://location.to/host.php'); curl_setopt($ch, CURLOPT_POST, count($fields)); curl_setopt($ch, CURLOPT_POSTFIELDS, $fstr); $result = curl_exec($ch); // get the return value from the host file curl_close($ch); var_dump($result); } PHP: If I understood you right, the above is a simple example of what you should be looking at. ** Oops... Realized this is a pretty old thread, but will probably help someone in the future..