cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

TZ environment variable getting set after an HTTPS request using cookiejar

From: Paul Kane <PKane_at_ufcu.org>
Date: Tue, 3 Apr 2007 16:25:37 -0500

Running PHP 5.2.1 as ISAPI on Windows 2000 SP4, included php_curl.dll
file version 5.2.1.1. My machine does not have a "TZ" environment
variable set -- preferring instead to use the date.timezone setting in
php.ini.
 
After running the script below, the TZ environment variable is set to
"GMT" for all future pages (as confirmed by phpinfo). This, of course,
affects all the date- functions used throughout my site.
 
This condition only happens when including the 'cookiejar' line below
and sending a request to an HTTPS server. Changing either of those
conditions does not permanently set the TZ environment variable.
wellsfargo.com is only an example; other https sites create the same
effect.

The only way I can shake the env variable once it's been set it to
restart IIS.
 
Please let me know what other information I can provide. php.ini follows
the script. I can provide a copy of the results of phpinfo() if someone
can suggest a convenient format for sending it.
 
Thank you.
 
Paul
 
==========[ php script ]==========
 
<?php
 
//======================================================================
// the environment variable "tz" will not be set at this point
//======================================================================
 
// phpinfo();
 
//======================================================================
// create a new cookie jar file
//======================================================================
 
$gs_cookie_jar_file_name = tempnam( 'C:/Temp', 'cookie' );
 
//======================================================================
// configure curl
//======================================================================
 
$gh_curl = curl_init();
 
curl_setopt( $gh_curl, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $gh_curl, CURLOPT_CAINFO, 'C:/PHP/cacert.pem' ); //
your location will be different
curl_setopt( $gh_curl, CURLOPT_FOLLOWLOCATION, 0 );
curl_setopt( $gh_curl, CURLOPT_COOKIEJAR, $gs_cookie_jar_file_name );
curl_setopt( $gh_curl, CURLOPT_URL, "https://www.wellsfargo.com/" );
 
//======================================================================
// send the request
//======================================================================
 
$ls_html_received = curl_exec( $gh_curl );
 
//======================================================================
// report results and clean up
//======================================================================
 
echo "Cookie file: " . $gs_cookie_jar_file_name . "<br />";
echo "Error message: " . curl_error( $gh_curl ) . "<br />";
echo "Error number: " . curl_errno( $gh_curl ) . "<br />";
echo "HTML:<br /><br />";
echo "<pre>" . htmlspecialchars( $ls_html_received ) . "</pre>";
 
curl_close ( $gh_curl );
 
if ( file_exists( $gs_cookie_jar_file_name ) ) unlink(
$gs_cookie_jar_file_name );
 
//======================================================================
// the environment variable "tz" is now set, and will remain so for all
future pages
//======================================================================
 
// phpinfo();
 
?>
 
==========[ php.ini, somewhat stripped ]==========

engine = On
zend.ze1_compatibility_mode = Off
short_open_tag = On
asp_tags = Off
precision = 14
y2k_compliance = On
output_buffering = Off
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func=
serialize_precision = 100
allow_call_time_pass_reference = On
safe_mode = Off
safe_mode_gid = Off
safe_mode_include_dir =
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH
disable_functions =
disable_classes =
expose_php = Off
max_execution_time = 500
max_input_time = 60
memory_limit = 16M
error_reporting = E_ALL & ~E_NOTICE
display_errors = On
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
error_log = C:\test.log
variables_order = "EGPCS"
register_globals = Off
register_long_arrays = Off
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 8M
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
include_path = ".;c:\php\includes"
doc_root =
user_dir =
extension_dir = "C:/ext/"
enable_dl = Off
cgi.force_redirect = 0
fastcgi.impersonate = 1
file_uploads = On
upload_tmp_dir = "C:\uploads"
upload_max_filesize = 1M
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
extension=php_curl.dll
extension=php_gd2.dll
extension=php_ldap.dll
extension=php_openssl.dll
extension=php_xsl.dll
date.timezone = "America/Chicago"
define_syslog_variables = Off
bcmath.scale = 0
session.save_handler = files
session.save_path = "C:\savepath"
session.use_cookies = 1
session.use_only_cookies = 1
session.name = TESTSESSION
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = 0
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "blah"
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400

This e-mail and any attachments are intended for the designated recipient(s) only.
 If you have received this e-mail in error, please notify administrator_at_ufcu.org and
disregard this message. However, if you have obtained this e-mail via electronic
eavesdropping, you are in violation of the Electronic Communications Privacy Act.
Furthermore disclosure, copying, distribution, or taking of any action in reliance
on the contents hereof is strictly prohibited without the explicit consent of
University Federal Credit Union.

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-04-03