[PHP-DEV] dir() class suggestion

2002-11-06 Thread Boris Penck
Hi there,

today I was playing around with dir() and my problem is that there is no
chance to tell dir()
weather to sort the files and directories. Sure, I'm able to read, dump
all entries to an array, sort and
print out the result. In cases with recursive directory trees a very bad
idea if the tree contains a large
number of subdirectories.

Well, my wish is something like that:

dir(string path [, sort method]) for sorting against name, size, date -
ok name may be a very good start.

At the moment $d = dir('./'); [...] $d-read(); will produce a result
like ls -la -U -- an unsorted way.

best regards
boris

( i hope i found the right place for these wishes )



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




[PHP-DEV] Re: Curl Multi Interface Patch

2002-10-20 Thread Boris Bukowski
Am Sunday 20 October 2002 03:31 schrieb Sterling Hughes:
 On Sun, 2002-10-20 at 02:16, Boris Bukowski wrote:
   ok, i can see the use in that, however, i think it can be more useful
   if you give the user the option of when to use the select() call -
   that's the whole point of the cURL multi interface, and while it may be
   useful in this case, the interface was designed to be much more
   powerful, and this patch does take a lot of that power away.
 
  There is no change on the interface, only the additional feature to
  execute the curl sessions parallel. After the curl_multi_exec you can use
  curl_info, curl_errno without problems. curl_get_content is needed cause
  curl_multi_exec cant return content if RETURNTRANSFER is Set. Do you see
  a better way to become the Content ?

 The interface change is not related to what is currently in the PHP
 interface but rather what the cURL multi interface is supposed to be,
 and how the interface proposed hides some of the inherent power of that
 interface.

Do you have Plans to implement this ?
I have no idea how to implement it.

Boris


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




[PHP-DEV] Curl Multi Interface Patch

2002-10-19 Thread Boris Bukowski
Hi,

now I made a Patch that is hopefully ok for you ;^)

I introduced the following functions:

curl_multi_init();
curl_multi_add ($multi,$ch1);
curl_multi_add ($multi,$ch2);
curl_multi_exec($multi);
curl_get_content($ch1);

thx, 

Boris 
?
// creates a multi session
$multi = curl_multi_init();

// start of a normal easy session
$ch1 = curl_init(http://192.168.4.2/;);
$ch2 = curl_init(http://192.168.4.2/;);

curl_setopt($ch1,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch2,CURLOPT_RETURNTRANSFER,1);

// adding the easy handles to the multi hndle
curl_multi_add ($multi,$ch1);
curl_multi_add ($multi,$ch2);

// executing all
curl_multi_exec($multi);

// getting content
$c1=curl_get_content($ch1);
$c2=curl_get_content($ch2);

curl_close($ch1);
curl_close($ch2);

echo brch1=.strlen($c1);
echo brch2=.strlen($c2);
?

Index: ext/curl/config.m4
===
RCS file: /repository/php4/ext/curl/config.m4,v
retrieving revision 1.16
diff -u -r1.16 config.m4
--- ext/curl/config.m4	4 Sep 2002 18:47:22 -	1.16
+++ ext/curl/config.m4	19 Oct 2002 13:26:40 -
 -9,6 +9,10 
 PHP_ARG_WITH(curlwrappers, if we should use CURL for url streams,
 [  --with-curlwrappers Use CURL for url streams], no, no)
 
+dnl Temporary option while we develop this aspect of the extension
+PHP_ARG_WITH(curl-multi, if we should use CURL for url streams,
+[  --with-curl-multi Use CURL Multi Interface], no, no)
+
 if test $PHP_CURL != no; then
   if test -r $PHP_CURL/include/curl/easy.h; then
 CURL_DIR=$PHP_CURL
 -63,6 +67,10 
 
   if test $PHP_CURLWRAPPERS != no ; then
 	AC_DEFINE(PHP_CURL_URL_WRAPPERS,1,[ ])
+  fi
+
+  if test $PHP_CURL_MULTI != no ; then
+	AC_DEFINE(PHP_CURL_MULTI,1,[ ])
   fi
 
   PHP_NEW_EXTENSION(curl, curl.c curlstreams.c, $ext_shared)
Index: ext/curl/curl.c
===
RCS file: /repository/php4/ext/curl/curl.c,v
retrieving revision 1.119
diff -u -r1.119 curl.c
--- ext/curl/curl.c	2 Oct 2002 16:44:48 -	1.119
+++ ext/curl/curl.c	19 Oct 2002 13:26:40 -
 -47,6 +47,11 
 static int  le_curl;
 #define le_curl_name cURL handle
 
+#ifdef PHP_CURL_MULTI
+static int  le_multi_curl;
+static void _php_multi_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
+#endif
+
 static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
 
 #define SAVE_CURL_ERROR(__handle, __err) (__handle)-err.no = (int) __err;
 -62,6 +67,12 
 	PHP_FE(curl_error,NULL)
 	PHP_FE(curl_errno,NULL)
 	PHP_FE(curl_close,NULL)
+#ifdef PHP_CURL_MULTI
+	PHP_FE(curl_multi_init,  NULL)
+	PHP_FE(curl_multi_exec,  NULL)
+	PHP_FE(curl_multi_add,   NULL)
+	PHP_FE(curl_get_content, NULL)
+#endif
 	{NULL, NULL, NULL}
 };
 /* }}} */
 -104,7 +115,11 
 PHP_MINIT_FUNCTION(curl)
 {
 	le_curl = zend_register_list_destructors_ex(_php_curl_close, NULL, curl, module_number);
-	
+
+#ifdef PHP_CURL_MULTI
+	le_multi_curl = zend_register_list_destructors_ex(_php_multi_curl_close, NULL, multi_curl, module_number);
+#endif
+
 	/* Constants for curl_setopt() */
 	REGISTER_CURL_CONSTANT(CURLOPT_DNS_USE_GLOBAL_CACHE);
 	REGISTER_CURL_CONSTANT(CURLOPT_DNS_CACHE_TIMEOUT);
 -931,7 +946,7 
 	if (ch-handlers-write-method == PHP_CURL_RETURN  ch-handlers-write-buf.len  0) {
 		if (ch-handlers-write-type != PHP_CURL_BINARY) 
 			smart_str_0(ch-handlers-write-buf);
-		RETURN_STRINGL(ch-handlers-write-buf.c, ch-handlers-write-buf.len, 0);
+		RETURN_STRINGL(ch-handlers-write-buf.c, ch-handlers-write-buf.len, 1);
 	}
 
 	RETURN_TRUE;
 -1117,6 +1132,138 
 	efree(ch);
 }	
 /* }}} */
+
+
+#ifdef PHP_CURL_MULTI
+
+/* {{{ proto void curl_multi_init(int ch)
+   Initialize a CURL-Multi session */
+PHP_FUNCTION(curl_multi_init)
+{
+php_multi_curl*multi_handle;
+multi_handle=emalloc(sizeof(php_multi_curl));
+multi_handle-cp = curl_multi_init();
+ZEND_REGISTER_RESOURCE(return_value, multi_handle, le_multi_curl);
+multi_handle-id = Z_LVAL_P(return_value);
+
+
+}
+
+/* {{{ proto void curl_multi_add(int ch, int ch)
+   Add a CURL Session to a CURL Multi session */
+PHP_FUNCTION(curl_multi_add)
+{
+zval**zidm;
+zval**zidc;
+php_curl *ch;
+php_multi_curl   *multi_handle;
+CURLcode  error;
+
+if (ZEND_NUM_ARGS() != 2 ||
+zend_get_parameters_ex(2, zidm, zidc) == FAILURE
+) {
+WRONG_PARAM_COUNT;
+}
+
+ZEND_FETCH_RESOURCE(multi_handle, php_multi_curl *, zidm, -1, le_curl_name, le_multi_curl);
+ZEND_FETCH_RESOURCE(ch, php_curl *, zidc, -1, le_curl_name, le_curl);
+
+error = curl_multi_add_handle(multi_handle-cp, ch-cp);
+SAVE_CURL_ERROR(ch, error);
+if (error != CURLE_OK) {
+RETURN_FALSE;
+}
+
+RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto void curl_multi_exec(int ch)
+   Perform a Multi-CURL session */
+PHP_FUNCTION(curl_multi_exec)
+{
+zval

[PHP-DEV] Re: Curl Multi Interface Patch

2002-10-19 Thread Boris Bukowski
Am Saturday 19 October 2002 23:59 schrieb Sterling Hughes:
 On Sat, 2002-10-19 at 15:42, Boris Bukowski wrote:
  Hi,
 
  now I made a Patch that is hopefully ok for you ;^)
 
  I introduced the following functions:
 
  curl_multi_init();
  curl_multi_add ($multi,$ch1);
  curl_multi_add ($multi,$ch2);
  curl_multi_exec($multi);
  curl_get_content($ch1);

 Why would this patch be useful, your implementation of curl_multi_exec()
 kinda defeats the whole purpose, doesn't it?
No,

It executes every curls session you add to a multi session in parallel.
if you have 10 sources with 1 second Latency you need only 1.2 Seconds
to fetch them, not 10 Seconds.
I think that is useful.

If you look on our search Page:
http://search.lycos.co.uk/cgi-bin/pursuit?query=cars
You find Sponsored Links, News, Fast Search Results, our Directory Search and 
the Ads on the right side. HTTP Requests around the half World. The added 
Latence is around 7 Seconds.

This moment we are using an additional Apache with a threads based Solution.
That one is a little bit ill and I will replace it with the curl multi 
interface.

thx,

Boris   

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




[PHP-DEV] Re: Curl Multi Interface Patch

2002-10-19 Thread Boris Bukowski

 ok, i can see the use in that, however, i think it can be more useful if
 you give the user the option of when to use the select() call - that's
 the whole point of the cURL multi interface, and while it may be useful
 in this case, the interface was designed to be much more powerful, and
 this patch does take a lot of that power away.
There is no change on the interface, only the additional feature to execute
the curl sessions parallel. After the curl_multi_exec you can use curl_info,
curl_errno without problems. curl_get_content is needed cause curl_multi_exec
cant return content if RETURNTRANSFER is Set. Do you see a better way to 
become the Content ?

Boris





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




[PHP-DEV] Curl multi interface in php_curl

2002-10-13 Thread Boris Bukowski

Hi,

i introduced the curl multi interface in php_curl.
Is this the right Place to post and discuss my Patch ?

Here an example what i introduced:
?
// creates a multi session
$multi = curl_multi_init();

// start of a normal easy session
$ch1 = curl_init(http://192.168.4.2/;);
$ch2 = curl_init(http://192.168.4.2/;);
curl_setopt($ch1,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch2,CURLOPT_RETURNTRANSFER,1);

// adding the easy handles to the multi hndle
curl_multi_add ($multi,$ch1);
curl_multi_add ($multi,$ch2);

// executing all
curl_multi_exec($multi);

// getting content
$c1=curl_get_content($ch1);
$c2=curl_get_content($ch2);

curl_close($ch1);
curl_close($ch2);

echo brch1=.strlen($c1);
echo brch2=.strlen($c2);
?

Regards Boris Bukowski

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




[PHP-DEV] Curl multi Interface Patch

2002-10-13 Thread Boris Bukowski

Hi,

this works for me with curl-7.9.8 and php-4.2.3 under Linux.

Problems are:
* curl_easy_cleanup segfaults after curl_multi_cleanup
* I have to introduce Version checking in these m4 Files 

Please give me suggestions howto make it clean and stable.

thx Boris

Here an example what this patch enables:
?
// creates a multi session
$multi = curl_multi_init();

// start of a normal easy session
$ch1 = curl_init(http://192.168.4.2/;);
$ch2 = curl_init(http://192.168.4.2/;);
curl_setopt($ch1,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch2,CURLOPT_RETURNTRANSFER,1);

// adding the easy handles to the multi hndle
curl_multi_add ($multi,$ch1);
curl_multi_add ($multi,$ch2);

// executing all
curl_multi_exec($multi);

// getting content
$c1=curl_get_content($ch1);
$c2=curl_get_content($ch2);

curl_close($ch1);
curl_close($ch2);

echo brch1=.strlen($c1);
echo brch2=.strlen($c2);
?

Regards Boris Bukowski


diff -ur php-4.2.3_orig/ext/curl/curl.c php-4.2.3/ext/curl/curl.c
--- php-4.2.3_orig/ext/curl/curl.c	2002-04-04 02:04:25.0 +0200
+++ php-4.2.3/ext/curl/curl.c	2002-10-13 20:54:37.0 +0200
 -28,6 +28,10 
 
 #include stdio.h
 #include string.h
+#include unistd.h
+#include time.h
+#includesys/timeb.h
+
 
 #ifdef PHP_WIN32
 #include winsock.h
 -45,9 +49,11 
 #include php_curl.h
 
 static int  le_curl;
+static int  le_multi_curl;
 #define le_curl_name cURL handle
 
 static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
+static void _php_multi_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
 
 #define SAVE_CURL_ERROR(__handle, __err) (__handle)-err.no = (int) __err;
 
 -55,9 +61,13 
  */
 function_entry curl_functions[] = {
 	PHP_FE(curl_init, NULL)
+	PHP_FE(curl_multi_init, NULL)
 	PHP_FE(curl_version,  NULL)
 	PHP_FE(curl_setopt,   NULL)
 	PHP_FE(curl_exec, NULL)
+	PHP_FE(curl_get_content, NULL)
+	PHP_FE(curl_multi_exec,  NULL)
+	PHP_FE(curl_multi_add,   NULL)
 	PHP_FE(curl_getinfo,  NULL)
 	PHP_FE(curl_error,NULL)
 	PHP_FE(curl_errno,NULL)
 -93,6 +103,7 
 	php_info_print_table_start();
 	php_info_print_table_row(2, CURL support,enabled);
 	php_info_print_table_row(2, CURL Information, curl_version());
+	php_info_print_table_row(2, CURL Multi Interface, enabled);
 	php_info_print_table_end();
 }
 /* }}} */
 -104,7 +115,8 
 PHP_MINIT_FUNCTION(curl)
 {
 	le_curl = zend_register_list_destructors_ex(_php_curl_close, NULL, curl, module_number);
-	
+	le_multi_curl = zend_register_list_destructors_ex(_php_multi_curl_close, NULL, curl, module_number);
+
 	/* Constants for curl_setopt() */
 	REGISTER_CURL_CONSTANT(CURLOPT_PORT);
 	REGISTER_CURL_CONSTANT(CURLOPT_FILE);
 -151,6 +163,7 
 	REGISTER_CURL_CONSTANT(CURLOPT_STDERR);
 	REGISTER_CURL_CONSTANT(CURLOPT_TRANSFERTEXT);
 	REGISTER_CURL_CONSTANT(CURLOPT_RETURNTRANSFER);
+	REGISTER_CURL_CONSTANT(CURLOPT_INMEMORY);
 	REGISTER_CURL_CONSTANT(CURLOPT_QUOTE);
 	REGISTER_CURL_CONSTANT(CURLOPT_POSTQUOTE);
 	REGISTER_CURL_CONSTANT(CURLOPT_INTERFACE);
 -542,6 +555,8 
 	(*ch)-handlers-write = ecalloc(1, sizeof(php_curl_write));
 	(*ch)-handlers-write_header = ecalloc(1, sizeof(php_curl_write));
 	(*ch)-handlers-read  = ecalloc(1, sizeof(php_curl_read));
+	(*ch)-multi   = 0;
+
 	memset((*ch)-err, 0, sizeof((*ch)-err));
 	
 	zend_llist_init((*ch)-to_free.str, sizeof(char *), 
 -602,6 +617,128 
 }
 /* }}} */
 
+
+/* {{{ proto int curl_init([string url])
+   Initialize a CURL session */
+PHP_FUNCTION(curl_multi_init)
+{
+	php_multi_curl*multi_handle;
+	multi_handle=emalloc(sizeof(php_multi_curl));
+	multi_handle-cp = curl_multi_init();
+	ZEND_REGISTER_RESOURCE(return_value, multi_handle, le_multi_curl);
+	multi_handle-id = Z_LVAL_P(return_value);
+
+
+}
+
+PHP_FUNCTION(curl_multi_exec)
+{
+	zval**zidm;
+php_multi_curl   *multi_handle;
+	CURLcode  error;
+	int   still_running;
+	struct timeb  start;
+	struct timeb  now;
+	long   nmili;
+
+	ftime(start);
+
+	if ( ZEND_NUM_ARGS() != 1  ||	 zend_get_parameters_ex(1, zidm) == FAILURE) {
+		WRONG_PARAM_COUNT;
+	}
+	ZEND_FETCH_RESOURCE(multi_handle, php_multi_curl *, zidm, -1, le_curl_name, le_multi_curl);
+
+		
+/* 	while(still_running) { */
+/* 		struct timespec t,tl; */
+/* 		t.tv_sec=0; */
+/* 		t.tv_nsec=5000; */
+/* 		curl_multi_perform(multi_handle-cp, still_running); */
+
+/* 		ftime(now); */
+/* 		nmili=(now.time-start.time)*1000 - start.millitm + now.millitm; */
+/* 		zend_printf(%dbr, nmili); */
+
+/* 		nanosleep(t,tl); */
+/* 	} */
+   
+	
+
+	while(still_running) {
+
+		struct timeval timeout;
+		intrc;
+		fd_set fdread;
+		fd_set fdwrite;
+		fd_set fdexcep;
+		intmaxfd;
+		
+		FD_ZERO(fdread);
+		FD_ZERO(fdwrite);
+		FD_ZERO(fdexcep);
+		
+		timeout.tv_sec = 0;
+		timeout.tv_usec = 10;
+
+		curl_multi_fdset(multi_handle-cp, fdread, fdwrite, fdexcep, maxfd);		
+		rc = select(maxfd+1, fdread, fdwrite, fdexcep, timeout);
+		
+		/*
+		ftime(now);
+		 nmili=(now.time

[PHP-DEV] CVS Account Request: boriswolf

2002-09-16 Thread Boris Schukin

I want to translate PHP documentation on russian

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




[PHP-DEV] CVS Account Request: klootz

2002-09-10 Thread Boris L. Zanin

Hi! I would like to take a part in PHP Documentation project as russian interpreter. 
My native language is russian. I have some experiance to translate technical text from 
english. Best wishes, Boris L. Zanin (aka Klootz) 4.IX.2002

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




[PHP-DEV] Bug #12991: Wrong content type while parsing .wml files which are parsed by php

2001-08-28 Thread boris

From: [EMAIL PROTECTED]
Operating system: Linux with Apache 1.3.20
PHP version:  4.0.6
PHP Bug Type: Unknown/Other Function
Bug description:  Wrong content type while parsing .wml files which are parsed by php

Hi there,

Scenario:

I added to the Apache Mime Types:

text/vnd.wap.wmlwml

Next I set PHP to parse .wml files in apache config:

AddType application/x-httpd-php .wml

What I want to do ? Parsing .wml files for wap pages.

What's the result ?

telnet domain.com 80
GET /wap.wml HTTP/1.0
Accept: text/vnd.wap.wml
returnreturn

Apache/PHP returns:

HTTP/1.1 200 OK
Date: Tue, 28 Aug 2001 07:04:44 GMT
Server: Apache/1.3.20 (Unix) PHP/4.0.6
X-Powered-By: PHP/4.0.6
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma: no-cache
Connection: close
Content-Type: text/html

I sent Accept: text/vnd.wap.wml and get Content-Type: text/html. That hat
to return a 406 Error - not accaptable.

Content Type seit in Apache Mime Config is ignored plus Accept: Header is
ignored. 

If I set a Content-Type with the Header funktion everthing ist fine - but
if not there have to be an Accept Error !

Best regards
Boris

-- 
Edit bug report at: http://bugs.php.net/?id=12991edit=1


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] PHP 4.0 Bug #10059: error message Fatal error: Unable to open etc...

2001-03-29 Thread boris . prin

From: [EMAIL PROTECTED]
Operating system: NT4
PHP version:  4.0.0
PHP Bug Type: *Install and Config
Bug description:  error message "Fatal error: Unable to open etc..."

When I try to open the page "index.php", this error message occurs :
Fatal error: Unable to open C:\WINNT\Profiles\s094097\Bureau\dsilv2\index.php in 
Unknown on line 0

here's the php.ini file


-- 
Edit Bug report at: http://bugs.php.net/?id=10059edit=1



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]