php-general Digest 4 Feb 2002 08:05:30 -0000 Issue 1151

Topics (messages 83325 through 83367):

Using session functions in PHP4.1.1
        83325 by: John Mpaliza
        83343 by: Yasuo Ohgaki
        83348 by: sagar N chand

Re: PEAR IMAGICK [WAS-> RANT: Why doesn't PHP have built-in support for dynamic]
        83326 by: Michael Kimsal
        83327 by: Christian Stocker

Displaying a please wait while doing a file upload?
        83328 by: Andy
        83333 by: Jeff Sheltren
        83334 by: Liam MacKenzie

Installing GD original question
        83329 by: Andy

Re: Why doesn't PHP have built-in support for dynamic image generation?
        83330 by: Andy
        83332 by: Christian Stocker

Re: Adding 6 digits to a str?
        83331 by: Andy

Re: file validation
        83335 by: Lars Torben Wilson

Natively compiled classes
        83336 by: Stephano Mariani

Re: attachment via mail PHP
        83337 by: Olev Rumm

mail() function not sending to Yahoo address
        83338 by: John P. Donaldson
        83339 by: Ricardo J. Veludo
        83346 by: Alex Shi
        83347 by: John P. Donaldson
        83363 by: TV Karthick Kumar

Re: crypt/Password
        83340 by: Jason G.

gzinflate and HTTP_RAW_POST_DATA problem
        83341 by: Noisey

PHP and XML
        83342 by: Peter J. Schoenster

Re: Sessions in URL not being recognized!
        83344 by: Yasuo Ohgaki

Re: use_trans_sid
        83345 by: Yasuo Ohgaki
        83349 by: Yasuo Ohgaki

ereg_replace help
        83350 by: John P. Donaldson
        83351 by: Martin Towell
        83353 by: Mike Frazer
        83354 by: John P. Donaldson
        83355 by: Martin Towell
        83356 by: Jason Wong

Warning: Failed opening
        83352 by: Mike_Bryeans.webbbs.org

Can php Read contents from MS Word in Exactly same format
        83357 by: Jack
        83358 by: Jason G.
        83367 by: jtjohnston

can't fint php.ini on OS X
        83359 by: Andy
        83365 by: Richard Baskett

include_path auto_prepend
        83360 by: Ed Lazor

Sockets
        83361 by: Evan Nemerson
        83364 by: Jason G.
        83366 by: Evan Nemerson

help - config setting directives in Apache config files not working
        83362 by: Ed Lazor

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Hi,

I'm using Win ME-Apache1.3.22-PHP4.1.1 and run this script:
<?php
session_start();
?>
I got this error: Php has caused an error in PHP4TS.DLL and will be closed. If the 
problem continues try to reboot your system.
And in the Apache log file I got : "Premature end of script headers".
This happens when using functions: session_start and session_register....
What can I do to resolve the problem.


John Mpaliza
--- End Message ---
--- Begin Message ---
John Mpaliza wrote:
> Hi,
> 
> I'm using Win ME-Apache1.3.22-PHP4.1.1 and run this script:
> <?php
> session_start();
> ?>
> I got this error: Php has caused an error in PHP4TS.DLL and will be closed. If the 
>problem continues try to reboot your system.
> And in the Apache log file I got : "Premature end of script headers".
> This happens when using functions: session_start and session_register....
> What can I do to resolve the problem.
> 
> 

You have invalid session.save_path, right?
It will be fixed next release or 4.2.0.

-- 
Yasuo Ohgaki
Please CC me when you reply to news/list messages.
Do not reply only to me :)

--- End Message ---
--- Begin Message ---
i dont know how u r using the thing like PHP on the fucking Win. Moreover
WinMe is the worst of all the OS's. So, better migrate to other OS as soon
as possible.

/sagar

----- Original Message -----
From: "John Mpaliza" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 04, 2002 1:23 AM
Subject: [PHP] Using session functions in PHP4.1.1


Hi,

I'm using Win ME-Apache1.3.22-PHP4.1.1 and run this script:
<?php
session_start();
?>
I got this error: Php has caused an error in PHP4TS.DLL and will be closed.
If the problem continues try to reboot your system.
And in the Apache log file I got : "Premature end of script headers".
This happens when using functions: session_start and session_register....
What can I do to resolve the problem.


John Mpaliza




_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

--- End Message ---
--- Begin Message ---

>>>
>>Someone seems to have started this, although I'm not sure why he's not
>>going more object-based.
>>
>>
>>http://pear.php.net/manual/en/packages.imagick.php
>>
>>I would prefer something like
>>
>>$i = new Imagick();
>>$i->read("file");
>>
>>instead of
>>$i= imagick_create();
>>imagick_read($i,"file");
>>
> 
> it's open source. just do it more object orientated ... and i'm sure the
> author (me...) will be very happy to impelement it ;)
> 
> honestly, OO-Interface was and still is planned, but i think
> more functionality is  much more needed at the moment than an oo
> interface. it was my first extension, so i wanted to keep it simple for
> the beginning.
> 
> but if someone else likes to implement it earlier, i'm the last, who has
> a problem with that (and don't expect 00 soon from me ...)
> 
> chregu
> 


Hello -

Please don't take my comment the wrong way - I know what I'd *like* to 
see (which is how I labelled it above) and what I'm capable of actually
contributing.  Doing C-code PHP extensions is beyond my capabilities, so 
I make do with what others contribute.  Simply because something is 
opensource doesn't mean everyone has equal talent to add in actual code.  :(

I thank you for your contribution of this code so far, and should you
continue to work on it in whatever fashion you choose, so much the 
better.  It is appreciated, OO or not (it would just be appreciated more 
if it was OO.)  :)

Thanks



--- End Message ---
--- Begin Message ---
In <[EMAIL PROTECTED]>, Michael Kimsal wrote:



>>>Someone seems to have started this, although I'm not sure why he's not
>>>going more object-based.
>>>
>>>
>>>http://pear.php.net/manual/en/packages.imagick.php
>>>
>>>I would prefer something like
>>>
>>>$i = new Imagick();
>>>$i->read("file");
>>>
>>>instead of
>>>$i= imagick_create();
>>>imagick_read($i,"file");
>>>
>>>
>> it's open source. just do it more object orientated ... and i'm sure
>> the author (me...) will be very happy to impelement it ;)
>> 
>> honestly, OO-Interface was and still is planned, but i think more
>> functionality is  much more needed at the moment than an oo interface.
>> it was my first extension, so i wanted to keep it simple for the
>> beginning.
>> 
>> but if someone else likes to implement it earlier, i'm the last, who
>> has a problem with that (and don't expect 00 soon from me ...)
>> 
>> chregu
>> 
>> 
>> 
> Hello -
> 
> Please don't take my comment the wrong way - I know what I'd *like* to

no, didn't take it the wrong way. maybe my answer was a bit to harsh ;)

> see (which is how I labelled it above) and what I'm capable of actually
> contributing.
> Doing C-code PHP extensions is beyond my capabilities, so I make do with
> what others contribute.  Simply because something is opensource doesn't
> mean everyone has equal talent to add in actual code.  :(
> I thank you for your contribution of this code so far, and should you
> continue to work on it in whatever fashion you choose, so much the
> better.  It is appreciated, OO or not (it would just be appreciated more
> if it was OO.)  :)

i would it appreciate as well, if it was OO. I was just not capable back
then to do it OO, maybe i am the next time I invest more time in it.

christian
--- End Message ---
--- Begin Message ---
Hi guys,

I would like to display something like: "please wait, uploading" while I am
doing a image creation which takes a while.

After the work is done, it should redirect to another page displaying
something like upload ok.

As far as I know the HEADER location satement is only valid if there is no
output in front. So I can't just echo the sentence.

Does anybody know the trick?

Thanx for your help.

Cheers Andy




--- End Message ---
--- Begin Message ---
Well, although this won't wait until exactly when the image creation is 
done, you could use a meta refresh tag to refresh to your new page after a 
certain number of seconds...

Create a php page with whatever code you need, and then have something like 
this:
<html>
<head>
<meta http-equiv= "refresh" content="5;URL='targetpage.php'">
<title>Please Wait</title>
</head>
<body>
Please wait...
</body>
</html>

This example would wait 5 seconds before loading targetpage.php.

Jeff

At 10:00 PM 2/3/2002 +0100, Andy wrote:
>Hi guys,
>
>I would like to display something like: "please wait, uploading" while I am
>doing a image creation which takes a while.
>
>After the work is done, it should redirect to another page displaying
>something like upload ok.
>
>As far as I know the HEADER location satement is only valid if there is no
>output in front. So I can't just echo the sentence.
>
>Does anybody know the trick?
>
>Thanx for your help.
>
>Cheers Andy


--- End Message ---
--- Begin Message ---
Ya, that's what I meant


----- Original Message -----
From: "Jeff Sheltren" <[EMAIL PROTECTED]>
To: "Andy" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, February 04, 2002 7:24 AM
Subject: Re: [PHP] Displaying a please wait while doing a file upload?


> Well, although this won't wait until exactly when the image creation is
> done, you could use a meta refresh tag to refresh to your new page after a
> certain number of seconds...
>
> Create a php page with whatever code you need, and then have something
like
> this:
> <html>
> <head>
> <meta http-equiv= "refresh" content="5;URL='targetpage.php'">
> <title>Please Wait</title>
> </head>
> <body>
> Please wait...
> </body>
> </html>
>
> This example would wait 5 seconds before loading targetpage.php.
>
> Jeff
>
> At 10:00 PM 2/3/2002 +0100, Andy wrote:
> >Hi guys,
> >
> >I would like to display something like: "please wait, uploading" while I
am
> >doing a image creation which takes a while.
> >
> >After the work is done, it should redirect to another page displaying
> >something like upload ok.
> >
> >As far as I know the HEADER location satement is only valid if there is
no
> >output in front. So I can't just echo the sentence.
> >
> >Does anybody know the trick?
> >
> >Thanx for your help.
> >
> >Cheers Andy
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--- End Message ---
--- Begin Message ---
Hi guys,

I think his original question was how to install GD!!!!!

It's not a big deal!
- Install PHP > 4.06
- edit the php.ini -> delete the comment tags from the gd import module
- restart your server if it is running not as a CGI extension

Thats it!!!

For gd2 support take care in PHP4.1.1 there are 2 gdmodules gd1 and gd2

Hope this helps,

Andy


"Christian Stocker" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> In <[EMAIL PROTECTED]>, Michael Kimsal wrote:
>
>
>
> >>>Someone seems to have started this, although I'm not sure why he's not
> >>>going more object-based.
> >>>
> >>>
> >>>http://pear.php.net/manual/en/packages.imagick.php
> >>>
> >>>I would prefer something like
> >>>
> >>>$i = new Imagick();
> >>>$i->read("file");
> >>>
> >>>instead of
> >>>$i= imagick_create();
> >>>imagick_read($i,"file");
> >>>
> >>>
> >> it's open source. just do it more object orientated ... and i'm sure
> >> the author (me...) will be very happy to impelement it ;)
> >>
> >> honestly, OO-Interface was and still is planned, but i think more
> >> functionality is  much more needed at the moment than an oo interface.
> >> it was my first extension, so i wanted to keep it simple for the
> >> beginning.
> >>
> >> but if someone else likes to implement it earlier, i'm the last, who
> >> has a problem with that (and don't expect 00 soon from me ...)
> >>
> >> chregu
> >>
> >>
> >>
> > Hello -
> >
> > Please don't take my comment the wrong way - I know what I'd *like* to
>
> no, didn't take it the wrong way. maybe my answer was a bit to harsh ;)
>
> > see (which is how I labelled it above) and what I'm capable of actually
> > contributing.
> > Doing C-code PHP extensions is beyond my capabilities, so I make do with
> > what others contribute.  Simply because something is opensource doesn't
> > mean everyone has equal talent to add in actual code.  :(
> > I thank you for your contribution of this code so far, and should you
> > continue to work on it in whatever fashion you choose, so much the
> > better.  It is appreciated, OO or not (it would just be appreciated more
> > if it was OO.)  :)
>
> i would it appreciate as well, if it was OO. I was just not capable back
> then to do it OO, maybe i am the next time I invest more time in it.
>
> christian


--- End Message ---
--- Begin Message ---
Hi guys,

I think his original question was how to install GD!!!!!

It's not a big deal!
- Install PHP > 4.06
- edit the php.ini -> delete the comment tags from the gd import module
- restart your server if it is running not as a CGI extension

Thats it!!!

For gd2 support take care in PHP4.1.1 there are 2 gdmodules gd1 and gd2

Hope this helps,

Andy


"Christian Stocker" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> In <[EMAIL PROTECTED]>, Michael Kimsal wrote:
>
>
>
> >>>Someone seems to have started this, although I'm not sure why he's not
> >>>going more object-based.
> >>>
> >>>
> >>>http://pear.php.net/manual/en/packages.imagick.php
> >>>
> >>>I would prefer something like
> >>>
> >>>$i = new Imagick();
> >>>$i->read("file");
> >>>
> >>>instead of
> >>>$i= imagick_create();
> >>>imagick_read($i,"file");
> >>>
> >>>
> >> it's open source. just do it more object orientated ... and i'm sure
> >> the author (me...) will be very happy to impelement it ;)
> >>
> >> honestly, OO-Interface was and still is planned, but i think more
> >> functionality is  much more needed at the moment than an oo interface.
> >> it was my first extension, so i wanted to keep it simple for the
> >> beginning.
> >>
> >> but if someone else likes to implement it earlier, i'm the last, who
> >> has a problem with that (and don't expect 00 soon from me ...)
> >>
> >> chregu
> >>
> >>
> >>
> > Hello -
> >
> > Please don't take my comment the wrong way - I know what I'd *like* to
>
> no, didn't take it the wrong way. maybe my answer was a bit to harsh ;)
>
> > see (which is how I labelled it above) and what I'm capable of actually
> > contributing.
> > Doing C-code PHP extensions is beyond my capabilities, so I make do with
> > what others contribute.  Simply because something is opensource doesn't
> > mean everyone has equal talent to add in actual code.  :(
> > I thank you for your contribution of this code so far, and should you
> > continue to work on it in whatever fashion you choose, so much the
> > better.  It is appreciated, OO or not (it would just be appreciated more
> > if it was OO.)  :)
>
> i would it appreciate as well, if it was OO. I was just not capable back
> then to do it OO, maybe i am the next time I invest more time in it.
>
> christian


"Erica Douglass" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Forgive my grumpiness, but I've spent the last several hours trying to
> install GD, etc.
>
> Let's be honest. PHP needs built-in support for creating dynamic images.
JSP
> already has this. Heck, you could even make it a configure option. As it
> stands now, you have to do the following:
>
> -- Install GD
> -- Install all of GD's numerous dependencies
> -- Install zlib
> -- Install freetype
> -- Install libttf
>
> THEN you have to compile PHP with all of the requisite options to enable
GD
> here and Freetype there, and PHP often won't compile without specifying
> /path/to/various/options, so you have to dig around your system to find
out
> where everything was installed. This results in a long and unwieldy
> configure statement which often does not work.
>
> PHP needs to have a simple configure option called --enable-dynamic-images
> or something similar. This should use built-in libraries that are
downloaded
> with the PHP source to create PNG images. Images can then be created with
> standard PHP functions. This would be much more useful than relying on
> several third-party solutions which do not easily work with each other.
This
> would also have the benefit of being more portable -- as I plan to release
> my code to several different people running different types of servers, I
> would like to minimize compatibility issues.
>
> If anyone has a better solution, feel free to email me. As it stands, I am
> very frustrated with this, and I haven't yet seen the light at the end of
> the tunnel.
>
> Thanks,
> Erica
>
>


--- End Message ---
--- Begin Message ---
In <[EMAIL PROTECTED]>, Andy wrote:

> Hi guys,
> 
> I think his original question was how to install GD!!!!!
> 
> It's not a big deal!
> - Install PHP > 4.06
> - edit the php.ini -> delete the comment tags from the gd import module
> - restart your server if it is running not as a CGI extension
> 
> Thats it!!!

If you have windows ...

But said that, i never had any problems in compiling php with gdlib under
debian testing...

chregu
--- End Message ---
--- Begin Message ---
thanx!!!
"John Lim" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Try http://php.net/str_pad
>
> Andy <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi guys,
> >
> > I am trying to force a int to be 8 digits. If it is only 3 dig filling
the
> > first ones with 0.
> >
> > Anyhow I tryed it with type casting, but it does not matter what I try,
I
> > always get an addition.
> >
> > E.g:
> >   $member_id is: 136
> >    should be: 00000136
> >
> > Here is the code, which is still returning 136:
> >
> >    for($i=0;$i<count($member_id);$i++){
> >        $length = strlen($member_id[$i]);
> >
> >         settype ($member_id[$i], "string");
> >         $zero = '0';
> >         settype ($zero, "string");
> >
> >         $member_id[$i] = $zero + $member_id[$i];
> >         echo $member_id[$i];
> >    }
> >
> > Does anybody know how to solve this thing??
> >
> > Thanx Andy
> >
> >
> >
> >
>
>


--- End Message ---
--- Begin Message ---
On Sun, 2002-02-03 at 12:12, Mike Frazer wrote:
> Your reply piqued my curiosity so I whipped together a script that times the
> execution of a foreach(), a while() and a for() loop executing the same
> commands.  The results were rather surprising in some ways but not really
> overall.
> 
> The while() loop is, as you stated, is quicker than a foreach() loop.
> However, the for() loop is the fastest of all three.  Below are the results
> of three tests:

Odd.. I get the opposite result:

Running test_foreach() 5000 times...2.6176570653915 seconds
Running test_for() 5000 times...3.0155370235443 seconds
Running test_while() 5000 times...2.0656290054321 seconds

Results: 
test_foreach_1: 2.6176570653915
test_for_2: 3.0155370235443
test_while_3: 2.0656290054321

Using the following code:

<?php
error_reporting(E_ALL);

function test_while() {
    global $upload_file;
    reset($upload_file);
    foreach ($upload_file as $line) {
        $num_pipes = substr_count($line, '|');
        if ($num_pipes < 2 || $num_pipes > 4) {
            return false;
        }
    }
    return true;
}


function test_foreach() {
    global $upload_file;
    reset($upload_file);
    while (list(, $line) = each($upload_file)) {
        $num_pipes = substr_count($line, '|');
        if ($num_pipes < 2 || $num_pipes > 4) {
            return false;
        }
    }
    return true;
}


function test_for() {
    global $upload_file;
    for ($i = 0; $i < count($upload_file); $i++) {
        $num_pipes = substr_count($upload_file[$i], '|');
        if ($num_pipes < 2 || $num_pipes > 4) {
            return false;
        }
    }
    return true;
}

$filename = 'testpipes.txt';
$upload_file = file($filename);

speedtest(array('test_foreach', 
                'test_for',
                'test_while'), 5000);

?>


Curioser and curiouser....


Torben

-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506

--- End Message ---
--- Begin Message ---
Hi!

A few colleagues and I found our PHP scripts running very slowly due to
the very processor intensive calculations on a site for a client. By
intensive calculations, I mean encryption, random number generation, and
prime verification, for some cryptographic algorithms. The code was very
object oriented using lots of classes.

We decided to write our own extension so that some of the code could be
compiled natively, and avoid the PHP interpreter altogether.

My question, is there any way of doing this with classes? I know I can
write individual functions in C and build them into a module, but how
can I do this with classes, if at all?

TIA

Stephano Mariani


--- End Message ---
--- Begin Message ---
aloooooooooooooooooooooooooo...............
"Olev Rumm" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hello

I was looking a way to fill a forms on line and send them over via the
server.

 Found a good(in my mind) and simple php mail skript

 from http://open.appideas.com/phpMailForm/source.php



 I managed to get it working. In my form there is a upload the the file
section.

 like this:

 <FORM name="your_file" value="2000000"><input name="attachment"
type="file">

 with max value of 2megs.

 It's not working. Pecause Im absolutely new in this I dont have a any idea
how to

 implement attachment part into this script.Original script is here:



 <?

 $MailToAddress = [EMAIL PROTECTED];

 $MailSubject = "Equipment Posting";

 if (!$MailFromAddress) {

 $MailFromAddress = [EMAIL PROTECTED];

 }

 $Header = "";

 $Footer = "";

 ?>

 <html>

 <body bgcolor="#FFFFFF">

 <font face="Arial"><center>

 The following information has been delivered:

 </center>



 <?

 if (!is_array($HTTP_POST_VARS))

 return;

 reset($HTTP_POST_VARS);

 while(list($key, $val) = each($HTTP_POST_VARS)) {

 $GLOBALS[$key] = $val;

 $val=stripslashes($val);

 echo "<b>$key</b> = $val<br>";

 $Message .= "$key = $val\n";

 }



 if ($Header) {

 $Message = $Header."\n\n".$Message;

 }



 if ($Footer) {

 $Message .= "\n\n".$Footer;

 }



 mail( "$MailToAddress", "$MailSubject", "$Message", "From:
$MailFromAddress");

 ?>

 <br><br>

 <b>Thank You!</b>

 <br><br>

 <a href="<? echo "$HTTP_REFERER"; ?>">Return To The Mail Form</a><br><br>

 <a href="/">Home Page</a><br><br>



 I dont know if I'm explained correctly so please excuse me.

Can anybody help please.

 Olev.




--- End Message ---
--- Begin Message ---
I've tried several PHP form processors, and all of
them have trouble sending the form contents to a Yahoo
address.  When I change the address to something other
than a Yahoo account, it sends the form results with
no problem.  Is there an issue with PHP's mail
function and Yahoo email addresses?

thanks,
John

__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com
--- End Message ---
--- Begin Message ---
Monday, February 04, 2002, 12:17:27 AM, recebi de John P. Donaldson:

John> I've tried several PHP form processors, and all of
John> them have trouble sending the form contents to a Yahoo
John> address.  When I change the address to something other
John> than a Yahoo account, it sends the form results with
John> no problem.  Is there an issue with PHP's mail
John> function and Yahoo email addresses?

check your SMTP server in the configuration of PHP

---- 
 Ricardo J. Veludo
 e-mail: [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Hi,

> Monday, February 04, 2002, 12:17:27 AM, recebi de John P. Donaldson:
> 
> John> I've tried several PHP form processors, and all of
> John> them have trouble sending the form contents to a Yahoo
> John> address.  When I change the address to something other
> John> than a Yahoo account, it sends the form results with
> John> no problem.  Is there an issue with PHP's mail
> John> function and Yahoo email addresses?
> 
> check your SMTP server in the configuration of PHP

Could you please further suggest how to check and what should
be check for this issue, and what could be a concern in php configuration
regarding to Yahoo account?

Thanks!

Alex

> 
> ---- 
>  Ricardo J. Veludo
>  e-mail: [EMAIL PROTECTED]
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
I found out it was my SMTP server that was actually
having the problem sending to Yahoo accounts, not PHP.
 I changed which server my PHP script used to send
mail and it sent it to my Yahoo account no problem.  

John

--- Alex Shi <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> > Monday, February 04, 2002, 12:17:27 AM, recebi de
> John P. Donaldson:
> > 
> > John> I've tried several PHP form processors, and
> all of
> > John> them have trouble sending the form contents
> to a Yahoo
> > John> address.  When I change the address to
> something other
> > John> than a Yahoo account, it sends the form
> results with
> > John> no problem.  Is there an issue with PHP's
> mail
> > John> function and Yahoo email addresses?
> > 
> > check your SMTP server in the configuration of PHP
> 
> Could you please further suggest how to check and
> what should
> be check for this issue, and what could be a concern
> in php configuration
> regarding to Yahoo account?
> 
> Thanks!
> 
> Alex
> 
> > 
> > ---- 
> >  Ricardo J. Veludo
> >  e-mail: [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
> 


__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com
--- End Message ---
--- Begin Message ---
 Hi,

    I use a form on my website for the visitors to send me the feedback and
use the mail() to do this job for me. And I get mails without any
problems.... I am happy... :-)..

Karthick


> I've tried several PHP form processors, and all of
> them have trouble sending the form contents to a Yahoo
> address.  When I change the address to something other
> than a Yahoo account, it sends the form results with
> no problem.  Is there an issue with PHP's mail
> function and Yahoo email addresses?
>
> thanks,
> John
>
> __________________________________________________
> Do You Yahoo!?
> Great stuff seeking new owners in Yahoo! Auctions!
> http://auctions.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

--- End Message ---
--- Begin Message ---
Hi,

I just thought i would point out that the entire point of crypt, md5, or 
MySQL password() function is to create a hash out of the original 
string.  However, they are designed so it is computationally infeasible to 
take a hash and find out the original string was.  Actually, it is 
impossible to know exactly what the original string was, because there may 
be more than one input that creates the same output.  The chances of this 
happening in a password case are EXTREMELLY RARE.

Sometimes, I to use md5 to hash passwords, and others, I just store the 
plain text passwords in the protected database. In most cases, if someone 
has access to your database, you have bigger things to worry about than 
them getting your password list.

Best Regards,

Jason Garber
IonZoft.com


At 11:56 PM 2/3/2002 +0800, you wrote:
>Hi there,
>I'm creating a user/password table that will use either Mysql Password or
>PHP Crypt function to encrypt the data. I know these functions are non
>reversible for good reason, but how do I deal with a situation where I want
>to email out a forgotton password? How can I get the passwrd back to a form
>recognisable to the user?
>Thanx in advance
>Phil
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---

I'm sending Content-type: application/x-gzip to
a PHP script, and I successfully write it to
a file using the HTTP_RAW_POST_DATA variable,
and can then gunzip it.  What confuses me is
that I *cannot* use the gzinflate function with
the same compressed data.  In other words,
the first method works, but the second does not.
Why?

First:
$f = fopen("/tmp/foo.gz","w");     
fwrite($f,$HTTP_RAW_POST_DATA);    
fclose($f);     
$f = gzopen("/tmp/foo.gz","r");     
$pixels = gzread($f,250000);     
gzclose($f);     

Second:

$pixels = gzinflate($HTTP_RAW_POST_DATA,250000);
 ERROR!!
    <b>Warning</b>:  gzinflate: data error in <b>saver.php</b> on line
<b>8</b><br> 

I don't get it.  It's the same data, right?

Noisey
Apache/1.3.12 (Unix) ApacheJServ/1.1.2 mod_mp3/0.25 PHP/4.0.6
--- End Message ---
--- Begin Message ---
Hi,

I'd appreciate any pointers you recommend to good sources of 
information on how to use PHP and XML. 

Thanks,

Peter

---------------------------
"Reality is that which, when you stop believing in it, doesn't go
away".
                -- Philip K. Dick
--- End Message ---
--- Begin Message ---
Try to enable output bufffering to see if it helps.

-- 
Yasuo Ohgaki
Please CC me when you reply to news/list messages.
Do not reply only to me :)

--- End Message ---
--- Begin Message ---
Justin French wrote:
> Hi,
> 
> When I run phpinfo(), use_trans_sid is set to 1 (assume 1 = enabled) on
> both my test server, and on my live server.  Great!
> 
> Only trouble is, when I disable cookies in my browser, the sessions are
> lost (in this case, each page asks me to login, rather than only once).
> 
> Is there anything special I have to do to ensure I have a system which
> uses cookies by default, and use_trans_sid as a second option, without
> have to carry the SID around in the URL? (page.php?<?=SID?>)?

Look for my "PHP4 sesison helper HTML" in www.zend.com Code Gallary.

-- 
Yasuo Ohgaki
Please CC me when you reply to news/list messages.
Do not reply only to me :)

--- End Message ---
--- Begin Message ---
Justin French wrote:
> Hi,
> 
> I didn't have much luck finding it... If you have a chance to send me a
> link, that'd be great, otherwise I'll just keep looking :)
> 
> Justin

Try link :)

http://www.zend.com/search_code_author.php?author=yohgaki

--
Yasuo Ohgaki

> 
> 
> 
> Yasuo Ohgaki wrote:
> 
>>Justin French wrote:
>>
>>>Hi,
>>>
>>>When I run phpinfo(), use_trans_sid is set to 1 (assume 1 = enabled) on
>>>both my test server, and on my live server.  Great!
>>>
>>>Only trouble is, when I disable cookies in my browser, the sessions are
>>>lost (in this case, each page asks me to login, rather than only once).
>>>
>>>Is there anything special I have to do to ensure I have a system which
>>>uses cookies by default, and use_trans_sid as a second option, without
>>>have to carry the SID around in the URL? (page.php?<?=SID?>)?
>>>
>>Look for my "PHP4 sesison helper HTML" in www.zend.com Code Gallary.
>>
>>--
>>Yasuo Ohgaki
>>Please CC me when you reply to news/list messages.
>>Do not reply only to me :)
>>
>>_________________________________________________________
>>Do You Yahoo!?
>>Get your free @yahoo.com address at http://mail.yahoo.com
>>
> 



-- 
Yasuo Ohgaki


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

--- End Message ---
--- Begin Message ---
I have a file open and can successfully write to it,
but I was to be able to search for a certain string of
text and replace it with a string of text.  I can't
figure out how to construct a proper ereg_replace
statement to search through this file and do the
replacing.  Examples I've seen are in the manner of:

$text = "line1\nline2\n";
fputs(ereg_replace("\n", "<br>", $text));

But how do I set the value of $text to be the entire
contents of the text file I've got open so it can
search through the entire file to find matches and
replace those matches?  Any help is greatly
appreciated.

Thanks,
John

__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com
--- End Message ---
--- Begin Message ---
$lines = file("filename_here.blah");  // read in file as an array
$content = implode("\n", $lines);     // join it all back together
$new_cont = ereg_replace("from", "to", $content);
fopen(...);  fputs(..., $new_content);  fclose(...);


if your intent is to replace all new lines with <br>'s then use this instead
...

$lines = file("filename_here.blah");  // read in file as an array
$content = implode("<br>", $lines);   // join it all back together
fopen(...);  fputs(..., $content);  fclose(...);


hope this helps

-----Original Message-----
From: John P. Donaldson [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 04, 2002 3:39 PM
To: php
Subject: [PHP] ereg_replace help


I have a file open and can successfully write to it,
but I was to be able to search for a certain string of
text and replace it with a string of text.  I can't
figure out how to construct a proper ereg_replace
statement to search through this file and do the
replacing.  Examples I've seen are in the manner of:

$text = "line1\nline2\n";
fputs(ereg_replace("\n", "<br>", $text));

But how do I set the value of $text to be the entire
contents of the text file I've got open so it can
search through the entire file to find matches and
replace those matches?  Any help is greatly
appreciated.

Thanks,
John

__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
nl2br() would serve that purpose as well.  See the Strings section of the
Functions Reference in the manual.

Mike Frazer



"Martin Towell" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> $lines = file("filename_here.blah");  // read in file as an array
> $content = implode("\n", $lines);     // join it all back together
> $new_cont = ereg_replace("from", "to", $content);
> fopen(...);  fputs(..., $new_content);  fclose(...);
>
>
> if your intent is to replace all new lines with <br>'s then use this
instead
> ...
>
> $lines = file("filename_here.blah");  // read in file as an array
> $content = implode("<br>", $lines);   // join it all back together
> fopen(...);  fputs(..., $content);  fclose(...);
>
>
> hope this helps
>
> -----Original Message-----
> From: John P. Donaldson [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 04, 2002 3:39 PM
> To: php
> Subject: [PHP] ereg_replace help
>
>
> I have a file open and can successfully write to it,
> but I was to be able to search for a certain string of
> text and replace it with a string of text.  I can't
> figure out how to construct a proper ereg_replace
> statement to search through this file and do the
> replacing.  Examples I've seen are in the manner of:
>
> $text = "line1\nline2\n";
> fputs(ereg_replace("\n", "<br>", $text));
>
> But how do I set the value of $text to be the entire
> contents of the text file I've got open so it can
> search through the entire file to find matches and
> replace those matches?  Any help is greatly
> appreciated.
>
> Thanks,
> John
>
> __________________________________________________
> Do You Yahoo!?
> Great stuff seeking new owners in Yahoo! Auctions!
> http://auctions.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---
I'm not actually replacing \n with <br>, I just used
that as an example.  When I tried Martin's solution, I
got a parse error on this line:

$content = implode($lines, "\n",);     

I checked the manual and it's constructed properly ..
I think.  What could be giving me the parse error on
this line.  The previous line reads:

$lines = file("log.txt");

Thanks,
John




--- Mike Frazer <[EMAIL PROTECTED]> wrote:
> nl2br() would serve that purpose as well.  See the
> Strings section of the
> Functions Reference in the manual.
> 
> Mike Frazer
> 
> 
> 
> "Martin Towell" <[EMAIL PROTECTED]> wrote in
> message
>
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > $lines = file("filename_here.blah");  // read in
> file as an array
> > $content = implode("\n", $lines);     // join it
> all back together
> > $new_cont = ereg_replace("from", "to", $content);
> > fopen(...);  fputs(..., $new_content); 
> fclose(...);
> >
> >
> > if your intent is to replace all new lines with
> <br>'s then use this
> instead
> > ...
> >
> > $lines = file("filename_here.blah");  // read in
> file as an array
> > $content = implode("<br>", $lines);   // join it
> all back together
> > fopen(...);  fputs(..., $content);  fclose(...);
> >
> >
> > hope this helps
> >
> > -----Original Message-----
> > From: John P. Donaldson
> [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, February 04, 2002 3:39 PM
> > To: php
> > Subject: [PHP] ereg_replace help
> >
> >
> > I have a file open and can successfully write to
> it,
> > but I was to be able to search for a certain
> string of
> > text and replace it with a string of text.  I
> can't
> > figure out how to construct a proper ereg_replace
> > statement to search through this file and do the
> > replacing.  Examples I've seen are in the manner
> of:
> >
> > $text = "line1\nline2\n";
> > fputs(ereg_replace("\n", "<br>", $text));
> >
> > But how do I set the value of $text to be the
> entire
> > contents of the text file I've got open so it can
> > search through the entire file to find matches and
> > replace those matches?  Any help is greatly
> > appreciated.
> >
> > Thanks,
> > John
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Great stuff seeking new owners in Yahoo! Auctions!
> > http://auctions.yahoo.com
> >
> > --
> > 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
> 


__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com
--- End Message ---
--- Begin Message ---
is that a direct copy from your code? - if it is, there's two errors
1. you have a comma just before the closing backet
2. the function is : implode(string glue, array pieces)
   so that would be : $content = implode("\n", $lines);
   ie. the two arguments are the wrong way around
Martin

-----Original Message-----
From: John P. Donaldson [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 04, 2002 4:32 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] ereg_replace help


I'm not actually replacing \n with <br>, I just used
that as an example.  When I tried Martin's solution, I
got a parse error on this line:

$content = implode($lines, "\n",);     

I checked the manual and it's constructed properly ..
I think.  What could be giving me the parse error on
this line.  The previous line reads:

$lines = file("log.txt");

Thanks,
John




--- Mike Frazer <[EMAIL PROTECTED]> wrote:
> nl2br() would serve that purpose as well.  See the
> Strings section of the
> Functions Reference in the manual.
> 
> Mike Frazer
> 
> 
> 
> "Martin Towell" <[EMAIL PROTECTED]> wrote in
> message
>
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > $lines = file("filename_here.blah");  // read in
> file as an array
> > $content = implode("\n", $lines);     // join it
> all back together
> > $new_cont = ereg_replace("from", "to", $content);
> > fopen(...);  fputs(..., $new_content); 
> fclose(...);
> >
> >
> > if your intent is to replace all new lines with
> <br>'s then use this
> instead
> > ...
> >
> > $lines = file("filename_here.blah");  // read in
> file as an array
> > $content = implode("<br>", $lines);   // join it
> all back together
> > fopen(...);  fputs(..., $content);  fclose(...);
> >
> >
> > hope this helps
> >
> > -----Original Message-----
> > From: John P. Donaldson
> [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, February 04, 2002 3:39 PM
> > To: php
> > Subject: [PHP] ereg_replace help
> >
> >
> > I have a file open and can successfully write to
> it,
> > but I was to be able to search for a certain
> string of
> > text and replace it with a string of text.  I
> can't
> > figure out how to construct a proper ereg_replace
> > statement to search through this file and do the
> > replacing.  Examples I've seen are in the manner
> of:
> >
> > $text = "line1\nline2\n";
> > fputs(ereg_replace("\n", "<br>", $text));
> >
> > But how do I set the value of $text to be the
> entire
> > contents of the text file I've got open so it can
> > search through the entire file to find matches and
> > replace those matches?  Any help is greatly
> > appreciated.
> >
> > Thanks,
> > John
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Great stuff seeking new owners in Yahoo! Auctions!
> > http://auctions.yahoo.com
> >
> > --
> > 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
> 


__________________________________________________
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
On Monday 04 February 2002 13:31, John P. Donaldson wrote:
> I'm not actually replacing \n with <br>, I just used
> that as an example.  When I tried Martin's solution, I
> got a parse error on this line:
>
> $content = implode($lines, "\n",);

You've got a trailing comma.


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
A halted retreat
Is nerve-wracking and dangerous.
To retain people as men -- and maidservants
Brings good fortune.
*/
--- End Message ---
--- Begin Message ---
I'm attempting to use the ISAPI interface to PHP but I keep getting

Warning: Failed opening '' for inclusion (include_path='\winbbs') in
Unknown on line 0

no matter what URL I request. The PHP doc's does say the ISAPI has some
bugs and I was wondering if maybe this is one of them.

But, before I go report I would like someone who knows what it SHOULD say
would look at what the ISAPI server module is passing to the ISAPI dll.
It's possible that something isn't being passed right.

Below is a debug dump of what is passed to the DLL. Items that contain
nothing after the - is an empty string.


============================================================================
==
EXTENSION_CONTROL_BLOCK
cbSize - 144
dwVersion - 262144
ConnID - 1
dwHttpStatusCode - 200
lpszLogData -  %s 
lpszMethod - GET
lpszQueryString - 
lpszPathInfo - 
lpszPathTranslated - 
cbAvailable - 0
lpbData - 
lpszContentType - 

HTTP_COOKIE - UID="1DISK13217"
HTTPS - off
SCRIPT_NAME - 265.php
AUTH_PASSWORD - 
AUTH_TYPE - 
AUTH_USER - 
CONTENT_LENGTH - 0
CONTENT_TYPE - 
PATH_TRANSLATED - 
QUERY_STRING - 
REMOTE_ADDR - 216.63.63.193
REMOTE_HOST - www.webbbs.org
REMOTE_USER - 216.63.63.193
REQUEST_METHOD - GET
SERVER_NAME - www.webbbs.org
SERVER_PORT - 80
SERVER_PROTOCOL - HTTP/1.0
SERVER_SOFTWARE - WebBBS 1.30
APPL_MD_PATH - C:\WINBBS\WORK\HTML\265.php
APPL_PHYSICAL_PATH - C:\WINBBS\WORK\HTML\265.php
INSTANCE_ID - 2
INSTANCE_META_PATH - \winbbs
LOGON_USER - 216.63.63.193
REQUEST_URI - GET http://www.webbbs.org/265.php HTTP/1.0
URL - http://www.webbbs.org/265.php
HSE_REQ_MAP_URL_TO_PATH_EX - C:\WINBBS\WORK\HTML\265.php
                   dwFlags - HSE_URL_FLAGS_SCRIPT|HSE_URL_FLAGS_READ
           cchMatchingPath - 28
            cchMatchingURL - 28
                  lpdwSize - 28



---
WebBBS Secure Internet Information Server v1.30.3 : Genesis ( http://www.webbbs.org/ )

Log on to www.webbbs.org for free web based and pop3 [ virus free and spam free ] 
email accounts. Free access to virus and internet security message boards with
10's of thousands of new messages every month.

--- End Message ---
--- Begin Message ---
Dear all
I had made  a news input page for one of the HR Manger to input the news for
the whole company to read, she is quick comfort with using MS word as a
editor, so is there anyway that the php can read the contents from the MS
Word and display as exactly same format to html?

If there is so, could any one suggest a book to me?

Thx a lot
Jack
[EMAIL PROTECTED]


--- End Message ---
--- Begin Message ---
MS Word is a proprietary, binary (i think), format...  Have fun.

There may be a solution out there.

If you could convince her to save it in Rich Text Format (rtf) and then 
upload it, your life would be much easier...

-Jason Garber


At 01:51 PM 2/4/2002 +0800, Jack wrote:
>Dear all
>I had made  a news input page for one of the HR Manger to input the news for
>the whole company to read, she is quick comfort with using MS word as a
>editor, so is there anyway that the php can read the contents from the MS
>Word and display as exactly same format to html?
>
>If there is so, could any one suggest a book to me?
>
>Thx a lot
>Jack
>[EMAIL PROTECTED]
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Is there a function or class written to convert rtf reliably to html? :)
Let me know,
John
A post & reply would be helpful if you can.

"Jason G." wrote:

> MS Word is a proprietary, binary (i think), format...  Have fun.
>
> There may be a solution out there.
>
> If you could convince her to save it in Rich Text Format (rtf) and then
> upload it, your life would be much easier...
>
> -Jason Garber
>
> At 01:51 PM 2/4/2002 +0800, Jack wrote:
> >Dear all
> >I had made  a news input page for one of the HR Manger to input the news for
> >the whole company to read, she is quick comfort with using MS word as a
> >editor, so is there anyway that the php can read the contents from the MS
> >Word and display as exactly same format to html?
> >
> >If there is so, could any one suggest a book to me?
> >
> >Thx a lot
> >Jack
> >[EMAIL PROTECTED]
> >
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
does anybody know where the php.ini is on Mac OS X?

I would like to activate gdlibrary.

Thanx for the hint Andy


--- End Message ---
--- Begin Message ---
Actually there is not a php.ini in MacOS X.  When you run phpinfo() see
where the php.ini file should be located and you can put your own there.

Cheers!

Rick

"There are only two ways to live your life. One is as though nothing is a
miracle. The other is as though everything is a miracle." - Albert Einstein

> From: "Andy" <[EMAIL PROTECTED]>
> Reply-To: "Andy" <[EMAIL PROTECTED]>
> Date: Mon, 4 Feb 2002 07:40:01 +0100
> To: [EMAIL PROTECTED]
> Subject: [PHP] can't fint php.ini on OS X
> 
> does anybody know where the php.ini is on Mac OS X?
> 
> I would like to activate gdlibrary.
> 
> Thanx for the hint Andy
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Ack... I recompiled my server and screwed something up in the process.  PHP 
files are parsed, but the include_path and auto_prepend variables are now 
ignored in my httpd.conf file.  Any idea of what I did?

I'm using virtual hosts and have

php_value include_path
php_value auto_prepend

in virtual host containers.  I didn't change the configuration files... 
When I run a script that tries doing any include, it says
Warning: Failed opening 'top.php' for inclusion (include_path='')

The include_path variable is empty... any idea why?

-Ed

--- End Message ---
--- Begin Message ---
Anyone know if there is a way yet to see if a socket is still connected to a 
host? I want to use a socket to send "GET / HTTP/1.0\r\n\r\n" over a socket, 
and retrieve everything the server sends. That part works great, but I can't 
figure out when the remote host disconnects.

I have the CVS version of php.

Here is the function so far. The problem is at the end.



function getdata ($host, $port, $data)
{
        /* well, the below comment would be true if i could get it working! */

        /* This function sends $data to $host:$port, then returns the response
         * until connection is severed. Great for HTTP, but won't usually work
         * too well in protocols where data needs to be analyzed, and replied
         * to appropriatly, such as POP v3 */

        // Create a socket
        $so = socket_create (AF_INET, SOCK_STREAM, getprotobyname("TCP"));
        if ( !$so )
        {
                exit("Could not create socket.\n");
        }

        // Connect...
        $ec = socket_connect ($so, $host, $port);
        if ( $ec < 0 )
        {
                exit ("ERROR $ec: ".socket_strerror($ec));
        }

        /* Write $data to socket. The manual doesn't say what it returns, but I'll
         * assume (even though it makes an ass out of you and me) that it is the same
         * as socket_connect() because it wouldn't be logical to return a 
descriptor. */
        $ec = socket_write ( $so, $data, ( strlen($data) ));
        if ( $ec < 0 )
        {
                exit ("ERROR $ec: ".socket_strerror($ec));
        }
        else
        {
                /* PROBLEM IS HERE- what do I put instead of while ( $x == 0 )??? */
                $x = 0;
                while ( $x == 0 )
                {
                        $buffer = socket_read ( $so, 1, PHP_BINARY_READ);
                        $string .= $buffer;
                }
        }

        // And (hopefully) return $string, for your viewing pleasure.
        return $string;
}
--- End Message ---
--- Begin Message ---
A quick note...

If you are not aware of cURL (curl.haxx.se), then you may want to look into it.

If you are, then please disregard this post.

-Jason Garber

At 11:06 PM 2/3/2002 -0800, Evan Nemerson wrote:
>Anyone know if there is a way yet to see if a socket is still connected to a
>host? I want to use a socket to send "GET / HTTP/1.0\r\n\r\n" over a socket,
>and retrieve everything the server sends. That part works great, but I can't
>figure out when the remote host disconnects.
>
>I have the CVS version of php.
>
>Here is the function so far. The problem is at the end.
>
>
>
>function getdata ($host, $port, $data)
>{
>         /* well, the below comment would be true if i could get it 
> working! */
>
>         /* This function sends $data to $host:$port, then returns the 
> response
>         * until connection is severed. Great for HTTP, but won't usually work
>         * too well in protocols where data needs to be analyzed, and replied
>         * to appropriatly, such as POP v3 */
>
>         // Create a socket
>         $so = socket_create (AF_INET, SOCK_STREAM, getprotobyname("TCP"));
>         if ( !$so )
>         {
>                 exit("Could not create socket.\n");
>         }
>
>         // Connect...
>         $ec = socket_connect ($so, $host, $port);
>         if ( $ec < 0 )
>         {
>                 exit ("ERROR $ec: ".socket_strerror($ec));
>         }
>
>         /* Write $data to socket. The manual doesn't say what it returns, 
> but I'll
>         * assume (even though it makes an ass out of you and me) that it 
> is the same
>         * as socket_connect() because it wouldn't be logical to return a
>descriptor. */
>         $ec = socket_write ( $so, $data, ( strlen($data) ));
>         if ( $ec < 0 )
>         {
>                 exit ("ERROR $ec: ".socket_strerror($ec));
>         }
>         else
>         {
>                 /* PROBLEM IS HERE- what do I put instead of while ( $x 
> == 0 )??? */
>                 $x = 0;
>                 while ( $x == 0 )
>                 {
>                         $buffer = socket_read ( $so, 1, PHP_BINARY_READ);
>                         $string .= $buffer;
>                 }
>         }
>
>         // And (hopefully) return $string, for your viewing pleasure.
>         return $string;
>}
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
I am aware of cURL, but I want to just use the standard PHP stuff if I can 
because I plan on releasing this when I'm done, and want to KISS for other 
people.

I know people have to compile PHP with sockets, but they will anyways for 
this project- I'm going to need socket_listen and socket_create_listen too.

This is for a proxy server which will work kinda like multiproxy, but should 
be more powerful. It will support direct connections or going through another 
proxy server. It seperates anonymous from non-anonymous proxy servers, then 
sorts them by speed. Data is stored in tab seperated value text files (I'm 
even avoiding mySQL!!!)

I just signed up for a page @ sourceforge. If anyone is interesting in 
helping out e-mail me.

Thanks for the idea, though. I think right now my fall-back is fsockopen. I 
would really love to get sockets working for this...





On Sunday 03 February 2002 23:32, you wrote:
> A quick note...
>
> If you are not aware of cURL (curl.haxx.se), then you may want to look into
> it.
>
> If you are, then please disregard this post.
>
> -Jason Garber
>
> At 11:06 PM 2/3/2002 -0800, Evan Nemerson wrote:
> >Anyone know if there is a way yet to see if a socket is still connected to
> > a host? I want to use a socket to send "GET / HTTP/1.0\r\n\r\n" over a
> > socket, and retrieve everything the server sends. That part works great,
> > but I can't figure out when the remote host disconnects.
> >
> >I have the CVS version of php.
> >
> >Here is the function so far. The problem is at the end.
> >
> >
> >
> >function getdata ($host, $port, $data)
> >{
> >         /* well, the below comment would be true if i could get it
> > working! */
> >
> >         /* This function sends $data to $host:$port, then returns the
> > response
> >         * until connection is severed. Great for HTTP, but won't usually
> > work * too well in protocols where data needs to be analyzed, and replied
> > * to appropriatly, such as POP v3 */
> >
> >         // Create a socket
> >         $so = socket_create (AF_INET, SOCK_STREAM,
> > getprotobyname("TCP")); if ( !$so )
> >         {
> >                 exit("Could not create socket.\n");
> >         }
> >
> >         // Connect...
> >         $ec = socket_connect ($so, $host, $port);
> >         if ( $ec < 0 )
> >         {
> >                 exit ("ERROR $ec: ".socket_strerror($ec));
> >         }
> >
> >         /* Write $data to socket. The manual doesn't say what it returns,
> > but I'll
> >         * assume (even though it makes an ass out of you and me) that it
> > is the same
> >         * as socket_connect() because it wouldn't be logical to return a
> >descriptor. */
> >         $ec = socket_write ( $so, $data, ( strlen($data) ));
> >         if ( $ec < 0 )
> >         {
> >                 exit ("ERROR $ec: ".socket_strerror($ec));
> >         }
> >         else
> >         {
> >                 /* PROBLEM IS HERE- what do I put instead of while ( $x
> > == 0 )??? */
> >                 $x = 0;
> >                 while ( $x == 0 )
> >                 {
> >                         $buffer = socket_read ( $so, 1, PHP_BINARY_READ);
> >                         $string .= $buffer;
> >                 }
> >         }
> >
> >         // And (hopefully) return $string, for your viewing pleasure.
> >         return $string;
> >}
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I found this on a web site...

 >When using PHP as an Apache module, you can also change the configuration 
settings >using directives in Apache configuration files and .htaccess files.

What do you do if you compile apache and php together - ie. not a 
module?  I compiled using the static method and now the php_value commands 
in my httpd.conf don't work.  Do I have to compile as a dynamic module to 
get them to work again?

-Ed

--- End Message ---

Reply via email to