Hi, I'm trying to run a script to get results for GoogieSpell ajax. The server doesn't seem to support the ssl:// protocol though? Is there an easy alternative for this? Google seems to want a secure connection.

  $google = "www.google.com";
  $lang=$_GET['lang'];
  $path="/tbproxy/spell?lang=$lang";
  $data = file_get_contents('php://input');
  $store = "";
  $fp = fsockopen("ssl://".$google, 443, $errno, $errstr, 30);
  if ($fp)
  {
   $out = "POST $path HTTP/1.1\r\n";
   $out .= "Host: $google\r\n";
   $out .= "Content-Length: " . strlen($data) . "\r\n";
   $out .= "Content-type: application/x-www-form-urlencoded\r\n";
   $out .= "Connection: Close\r\n\r\n";
   $out .= $data;
   fwrite($fp, $out);
   while (!feof($fp)) {
       $store .= fgets($fp, 128);
   }
   

    The obvious way is simply to use a server which DOES support the ssl: protocol. It should be built with your PHP.

    Talk to your operations staff and have them deploy a new package which includes ssl support.

    You may also want to consider using the fopen https wrapper instead of rolling your own HTTP code, it's less error prone.

    Mark

      The first thing that comes to my mind is cURL -- if it available on the host you're using, of course.. 🙂

        Write a Reply...