How to impliment 'https' connection with Apache2.2 Usig PHP any other related...

Sajith R

New member
...technology?? I have Apache2.2 ..? How to impliment 'https' connection with Apache2.2 Usig PHP any other related technology?? I have Apache 2.2 with Open SSL.

For php coding show some sample coding and references please.

Regards.
 
You can make a HTTPS connection and keep it open to feed data, that's impossible. But you can make HTTPS requests using the cURL library. See this function that makes a https request.

To add GET/POST data and better result parsing, just read about the cURL from PHP manual and try to var_dump the results :) Happy coding!


function MakeHTTPSRequest($url,$refer = "",$usecookie = false) {

if ($usecookie) {

if (file_exists($usecookie)) {

if (!is_writable($usecookie)) {

return "Can't write to $usecookie cookie file, change file permission to 777 or remove read only for windows.";
}
} else {
$usecookie = "cookie.txt";
if (!is_writable($usecookie)) {

return "Can't write to $usecookie cookie file, change file permission to 777 or remove read only for windows.";
}
}

}

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);

curl_setopt($ch, CURLOPT_HEADER, 1);

curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");

if ($usecookie) {
curl_setopt($ch, CURLOPT_COOKIEJAR, $usecookie);

curl_setopt($ch, CURLOPT_COOKIEFILE, $usecookie);
}

if ($refer != "") {

curl_setopt($ch, CURLOPT_REFERER, $refer );

}
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

$result =curl_exec ($ch);

curl_close ($ch);

return $result;
}
 
Back
Top