PHP has "heredoc" capability, though it'll look a little strange since
you'll need the () around the parameters.  It's also used a little bit
differently.  Here's the code:


$fp = popen("$Openssl_cmd req -new -config /usr/lib/openssl.cnf "
            . "-key $cert_dir/key -days $days -out $cert_dir/request
1>&2", "w");
fputs ($fp, <<<USER_INFO
$subject[C]
$subject[ST]
$subject[L]
$subject[O]
$subject[OU]
$subject[CN]
$subject[Email]
USER_INFO
);
pclose($fp);

---

PHP uses <<< instead of << and does not have a ; at the end of the first
line.  Typically, (using print), the "end" statement would have a ;, but
since you need to close the ()'s, and since you can't have anything
*BUT* a ; following the end statement, you need to put the ); on the
next line.


Good luck!



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, June 12, 2002 12:19 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Equivalent of this in php




What would be the equivalent of this in php. Mostly the open (REQ and
the print REQ <<USER_INFO; to the close REQ; Could somebody just point
me in the write
direction.



          open (REQ, "|$Openssl_cmd req -new -config
/usr/lib/openssl.cnf "
                  . "-key $cert_dir/key -days $days -out
$cert_dir/request 1>&2") ||
                      return MSG_error("ssl_cant_gen_request");
        
            print REQ <<USER_INFO;
$subject{'C'}
$subject{'ST'}
$subject{'L'}
$subject{'O'}
$subject{'OU'}
$subject{'CN'}
$subject{'Email'}
USER_INFO
        ;
           close REQ;

  

  

-- 
Best regards,
 rdkurth                          mailto:[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to