[PHP] Re: fsockopen in phpmailer and tls

2008-09-07 Thread Manuel Lemos

Hello,

on 09/05/2008 12:20 AM Larry Brown said the following:

I am having a ball of a time trying to figure this one out... If anyone
has dealt with this before I'd love to get some morsels of wisdom from
you...

I am trying to connect to a postfix server I have set up remotely using
smtp auth with tls.  The postfix appears to be configured correctly at
this point.  I can telnet to port 25 and it will list tls as an option
as the howto describes it should.  I try to connect from php and get:

PHP Warning:  fsockopen(): SSL operation failed with code 1. OpenSSL
Error messages:
error:1408F10B:SSL routines:func(143):reason(267)
in /opt/scriptsMain/include/class.smtp.php on line 122


I suspect that you are using the wrong port to send messages via SSL . 
The fact that port 25 SMTP connections list TLS as available mode, that 
is for starting TLS after the connection was started.


I use this class to send messages via SMTP using SSL to Gmail, but the 
port is not 25. You may want to try it to see if it works for your 
server. Take a look at the test_smtp_message.php example script.


http://www.phpclasses.org/mimemessage

You also need this for SMTP deliveries:

http://www.phpclasses.org/smtpclass

and this to initiate authentication:

http://www.phpclasses.org/sasl



--

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] Re: fsockopen on ssl://

2008-05-19 Thread bob pilly
Hi

Apache is serving php correctly and i can see this from a  
and everything else works fine just this one call to fsockopen using ssl://. Is 
there some sort of extra configuration required for apache to be able to do 
this that i am not aware of?

Bob


- Original Message 
From: Ólafur Waage <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Sent: Monday, 19 May, 2008 10:26:58 AM
Subject: Re: [PHP] Re: fsockopen on ssl://

Are you doing the command line on the same machine as the server?
Have you checked out the apache configuration? Since phpcli runs alone. (iirc)

2008/5/18 bob pilly <[EMAIL PROTECTED]>:
> Hi Manuel
>
> Thanks for the reply. I have tested it with a timeout of 20 seconds and the 
> same thing occurs. It works as before from the command line and not form 
> within apache.. Any more ideas?
>
> Cheers
>
> Bob
>
>
> - Original Message 
> From: Manuel Lemos <[EMAIL PROTECTED]>
> To: bob pilly <[EMAIL PROTECTED]>
> Cc: php-general@lists.php.net
> Sent: Wednesday, 14 May, 2008 4:26:41 PM
> Subject: Re: fsockopen on ssl://
>
> Hello,
>
> on 05/13/2008 04:37 PM bob pilly said the following:
>> Hi all
>>
>> I have tried researching this issue but havent come up with any solution so 
>> im hoping someone has seen it before and can help. I have the following test 
>> script that uses fsockopen to connect to a https site, get the contents and 
>> outputs it.
>>
>> > $host = "www.microsoft.com";
>> $path = "/";
>> $fh = fsockopen("ssl://".$host, 443, $errno, $errstr, 5);//opens url for 
>> reading with a timeout of 2 seconds
>>
>> if (!$fh){
>> echo "FAIL: $errno $errstr ";
>> }
>> else{
>> $out = "GET $path HTTP/1.1\r\n";
>> $out .= "Host: $host\r\n";
>> $out .= "Connection: Close\r\n";
>> $out .= "\r\n";
>> fwrite($fh, $out);
>> stream_set_timeout($fh,2);
>> $info = stream_get_meta_data($fh);
>> if($info['timed_out']){
>> echo "TIMEOUT\n";
>> }
>> else{
>> $haystack = "";
>> while (!feof($fh)) {
>> $haystack.= fgets($fh, 4096);
>> }
>> }
>> print $haystack;
>> fclose($fh);
>> }
>> ?>
>>
>> if i run this script using php -f test.php it works fine. However if i try 
>> and run this on my loca apache server i get the following error:
>>
>> Warning:  fsockopen() [function.fsockopen]:unable to connect to 
>> ssl://www.microsoft.com:443 (A connection attemptfailed because the 
>> connected party did not properly respond after aperiod of time, or 
>> established connection failed because connected hosthas failed to respond.) 
>> in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php on 
>> line 4
>> FAIL: 10060 A connection attempt failed because the connected party didnot 
>> properly respond after a period of time, or established connectionfailed 
>> because connected host has failed to respond.
>>
>> As you can see from that error i am using windows and apache 2.2. My php 
>> version is 5.25. I have Registered Stream Socket Transports tcp, udp, ssl, 
>> sslv3, sslv2, tlsin my config.
>
> I suspect that you are giving a very short timeout but then you are not
> handling the timeout error properly.
>
> Anyway, before reinventing the wheel, you may to try this HTTP client
> class that supports many options including establishing SSL corrections
> and setting and handling timeouts correctly.
>
> http://www.phpclasses.org/httpclient
>
> --
>
> Regards,
> Manuel Lemos
>
> PHP professionals looking for PHP jobs
> http://www.phpclasses.org/professionals/
>
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
>
>
>
>  __
> Sent from Yahoo! Mail.
> A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html

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


  __
Sent from Yahoo! Mail.
A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html

Re: [PHP] Re: fsockopen on ssl://

2008-05-18 Thread Ólafur Waage
Are you doing the command line on the same machine as the server?
Have you checked out the apache configuration? Since phpcli runs alone. (iirc)

2008/5/18 bob pilly <[EMAIL PROTECTED]>:
> Hi Manuel
>
> Thanks for the reply. I have tested it with a timeout of 20 seconds and the 
> same thing occurs. It works as before from the command line and not form 
> within apache.. Any more ideas?
>
> Cheers
>
> Bob
>
>
> - Original Message 
> From: Manuel Lemos <[EMAIL PROTECTED]>
> To: bob pilly <[EMAIL PROTECTED]>
> Cc: php-general@lists.php.net
> Sent: Wednesday, 14 May, 2008 4:26:41 PM
> Subject: Re: fsockopen on ssl://
>
> Hello,
>
> on 05/13/2008 04:37 PM bob pilly said the following:
>> Hi all
>>
>> I have tried researching this issue but havent come up with any solution so 
>> im hoping someone has seen it before and can help. I have the following test 
>> script that uses fsockopen to connect to a https site, get the contents and 
>> outputs it.
>>
>> > $host = "www.microsoft.com";
>> $path = "/";
>> $fh = fsockopen("ssl://".$host, 443, $errno, $errstr, 5);//opens url for 
>> reading with a timeout of 2 seconds
>>
>> if (!$fh){
>> echo "FAIL: $errno $errstr ";
>> }
>> else{
>> $out = "GET $path HTTP/1.1\r\n";
>> $out .= "Host: $host\r\n";
>> $out .= "Connection: Close\r\n";
>> $out .= "\r\n";
>> fwrite($fh, $out);
>> stream_set_timeout($fh,2);
>> $info = stream_get_meta_data($fh);
>> if($info['timed_out']){
>> echo "TIMEOUT\n";
>> }
>> else{
>> $haystack = "";
>> while (!feof($fh)) {
>> $haystack.= fgets($fh, 4096);
>> }
>> }
>> print $haystack;
>> fclose($fh);
>> }
>> ?>
>>
>> if i run this script using php -f test.php it works fine. However if i try 
>> and run this on my loca apache server i get the following error:
>>
>> Warning:  fsockopen() [function.fsockopen]:unable to connect to 
>> ssl://www.microsoft.com:443 (A connection attemptfailed because the 
>> connected party did not properly respond after aperiod of time, or 
>> established connection failed because connected hosthas failed to respond.) 
>> in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test.php on 
>> line 4
>> FAIL: 10060 A connection attempt failed because the connected party didnot 
>> properly respond after a period of time, or established connectionfailed 
>> because connected host has failed to respond.
>>
>> As you can see from that error i am using windows and apache 2.2. My php 
>> version is 5.25. I have Registered Stream Socket Transports tcp, udp, ssl, 
>> sslv3, sslv2, tlsin my config.
>
> I suspect that you are giving a very short timeout but then you are not
> handling the timeout error properly.
>
> Anyway, before reinventing the wheel, you may to try this HTTP client
> class that supports many options including establishing SSL corrections
> and setting and handling timeouts correctly.
>
> http://www.phpclasses.org/httpclient
>
> --
>
> Regards,
> Manuel Lemos
>
> PHP professionals looking for PHP jobs
> http://www.phpclasses.org/professionals/
>
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
>
>
>
>  __
> Sent from Yahoo! Mail.
> A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html

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



[PHP] Re: fsockopen on ssl://

2008-05-18 Thread bob pilly
Hi Manuel

Thanks for the reply. I have tested it with a timeout of 20 seconds and the 
same thing occurs. It works as before from the command line and not form within 
apache.. Any more ideas?

Cheers

Bob


- Original Message 
From: Manuel Lemos <[EMAIL PROTECTED]>
To: bob pilly <[EMAIL PROTECTED]>
Cc: php-general@lists.php.net
Sent: Wednesday, 14 May, 2008 4:26:41 PM
Subject: Re: fsockopen on ssl://

Hello,

on 05/13/2008 04:37 PM bob pilly said the following:
> Hi all
> 
> I have tried researching this issue but havent come up with any solution so 
> im hoping someone has seen it before and can help. I have the following test 
> script that uses fsockopen to connect to a https site, get the contents and 
> outputs it.
> 
>  $host = "www.microsoft.com";
> $path = "/";
> $fh = fsockopen("ssl://".$host, 443, $errno, $errstr, 5);//opens url for 
> reading with a timeout of 2 seconds
> 
> if (!$fh){
> echo "FAIL: $errno $errstr ";
> }
> else{
> $out = "GET $path HTTP/1.1\r\n";
> $out .= "Host: $host\r\n";
> $out .= "Connection: Close\r\n";
> $out .= "\r\n";
> fwrite($fh, $out);
> stream_set_timeout($fh,2);
> $info = stream_get_meta_data($fh);
> if($info['timed_out']){
> echo "TIMEOUT\n";
> }
> else{
> $haystack = "";
> while (!feof($fh)) {
> $haystack.= fgets($fh, 4096);
> }
> }
> print $haystack;
> fclose($fh);
> }
> ?>
> 
> if i run this script using php -f test.php it works fine. However if i try 
> and run this on my loca apache server i get the following error:
> 
> Warning:  fsockopen() [function.fsockopen]:unable to connect to 
> ssl://www.microsoft.com:443 (A connection attemptfailed because the connected 
> party did not properly respond after aperiod of time, or established 
> connection failed because connected hosthas failed to respond.) in C:\Program 
> Files\Apache Software Foundation\Apache2.2\htdocs\test.php on line 4
> FAIL: 10060 A connection attempt failed because the connected party didnot 
> properly respond after a period of time, or established connectionfailed 
> because connected host has failed to respond.
> 
> As you can see from that error i am using windows and apache 2.2. My php 
> version is 5.25. I have Registered Stream Socket Transports tcp, udp, ssl, 
> sslv3, sslv2, tlsin my config.

I suspect that you are giving a very short timeout but then you are not
handling the timeout error properly.

Anyway, before reinventing the wheel, you may to try this HTTP client
class that supports many options including establishing SSL corrections
and setting and handling timeouts correctly.

http://www.phpclasses.org/httpclient

-- 

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/



  __
Sent from Yahoo! Mail.
A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html

[PHP] Re: fsockopen on ssl://

2008-05-13 Thread Manuel Lemos
Hello,

on 05/13/2008 04:37 PM bob pilly said the following:
> Hi all
> 
> I have tried researching this issue but havent come up with any solution so 
> im hoping someone has seen it before and can help. I have the following test 
> script that uses fsockopen to connect to a https site, get the contents and 
> outputs it.
> 
>  $host = "www.microsoft.com";
> $path = "/";
> $fh = fsockopen("ssl://".$host, 443, $errno, $errstr, 5);//opens url for 
> reading with a timeout of 2 seconds
> 
> if (!$fh){
> echo "FAIL: $errno $errstr ";
> }
> else{
> $out = "GET $path HTTP/1.1\r\n";
> $out .= "Host: $host\r\n";
> $out .= "Connection: Close\r\n";
> $out .= "\r\n";
> fwrite($fh, $out);
> stream_set_timeout($fh,2);
> $info = stream_get_meta_data($fh);
> if($info['timed_out']){
> echo "TIMEOUT\n";
> }
> else{
> $haystack = "";
> while (!feof($fh)) {
> $haystack.= fgets($fh, 4096);
> }
> }
> print $haystack;
> fclose($fh);
> }
> ?>
> 
> if i run this script using php -f test.php it works fine. However if i try 
> and run this on my loca apache server i get the following error:
> 
> Warning:  fsockopen() [function.fsockopen]:unable to connect to 
> ssl://www.microsoft.com:443 (A connection attemptfailed because the connected 
> party did not properly respond after aperiod of time, or established 
> connection failed because connected hosthas failed to respond.) in C:\Program 
> Files\Apache Software Foundation\Apache2.2\htdocs\test.php on line 4
> FAIL: 10060 A connection attempt failed because the connected party didnot 
> properly respond after a period of time, or established connectionfailed 
> because connected host has failed to respond.
> 
> As you can see from that error i am using windows and apache 2.2. My php 
> version is 5.25. I have Registered Stream Socket Transports tcp, udp, ssl, 
> sslv3, sslv2, tlsin my config.

I suspect that you are giving a very short timeout but then you are not
handling the timeout error properly.

Anyway, before reinventing the wheel, you may to try this HTTP client
class that supports many options including establishing SSL corrections
and setting and handling timeouts correctly.

http://www.phpclasses.org/httpclient

-- 

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



[PHP] Re: fsockopen error messages

2006-11-06 Thread Myron Turner
You may have your host incorrectly set.  I posted an example yesterday 
of how to use sockets with POST under the thread ": [PHP] XML Sending 
problem"



Philip Thompson wrote:

Hi.

I have not dealt much with fsockopen, but after looking at many 
examples, I'm not finding the answers I need. fsockopen is not returning 
anything and I'm trying to find out what the issue is. The error 
messages are not provided and I'm not sure what's going on. Help please!


";
echo "Error: $errstr ($errno)\n";
}
?>

Thanks,
~Philip



--

_
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/

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



[PHP] Re: fsockopen, openssl error

2006-01-20 Thread Barry

James Benson wrote:

Seems like he can't start TLS.´

Have you tried a newer version of PHP than 4.4.2?

If so, i would like to know what happened.

Barry






Just compiled 5.1.2 and 4.4.1, it happended again with 4.4.1 but not 
with 5.1.2, I dont have time to try 4.4.0 but will do later.



One thing i forgot to say is I have recently switched from fedora core 4 
to ubuntu 5.1, would that make any difference?



BTW, Im using apache 2.2.0, openssl 0.9.8a



Thanks,

James


No doesnt make any difference.

but it really seems that 4.4.2 has some bugs with ssl.
I encounter the same here.

use newer versions. should help then.

Barry

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



[PHP] Re: fsockopen, openssl error

2006-01-20 Thread James Benson

Seems like he can't start TLS.´

Have you tried a newer version of PHP than 4.4.2?

If so, i would like to know what happened.

Barry





Just compiled 5.1.2 and 4.4.1, it happended again with 4.4.1 but not 
with 5.1.2, I dont have time to try 4.4.0 but will do later.



One thing i forgot to say is I have recently switched from fedora core 4 
to ubuntu 5.1, would that make any difference?



BTW, Im using apache 2.2.0, openssl 0.9.8a



Thanks,

James

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



[PHP] Re: fsockopen, openssl error

2006-01-20 Thread Barry

James Benson wrote:
Im running into the followng error when trying to use fsockopen with the 
openssl extension,




Warning: fsockopen(): php_stream_sock_ssl_activate_with_method: failed 
to create an SSL context


Warning: fsockopen(): failed to activate SSL mode 1

Socket Error: Operation now in progress




Anyone have any clues as to what this may be or why its happening?

Perhaps a compile problem, anyway, I probably will try 4.4.0 because ive 
not made any changes to the script for a few months but have upgraded to 
4.4.2 recently then get this error, very suspicious i think?




James


Seems like he can't start TLS.´

Have you tried a newer version of PHP than 4.4.2?

If so, i would like to know what happened.

Barry

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



[PHP] Re: Fsockopen error

2005-11-01 Thread Curt Zirzow
On Tue, 01 Nov 2005 14:06:04 -0500, Robert Prentice wrote:

> I am attempting to connect to a remote server using fsockopen to post data
> to a php file. Here is the error i get:
> 
> Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name
> or service not known (is your IPV6 configuration correct? If this error
> happens all the time, try reconfiguring PHP using -- disable-ipv6 option
> to configure) in /home/customerservice/docs/ admin_ahmed/test.php on line
> 37
> 
> Here is the code i am using:
> 
> 
> $reply = http_post("https://www.safetrustprocessing.com";, 80, "/
> xml_order_processing.php", array("myXml" => $xml)); function http_post
> ($server, $port, $url, $vars) {
>  $user_agent = "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)";
> ...
> 
> Any ideas on the problem?

i would guess http_post() is the problem, i have no clue what it really
does.


Curt.
-- 
http://news.zirzow.dyndns.org/

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



RE: [PHP] Re: fsockopen() errors.

2004-03-09 Thread Phil Ewington - 43 Plc
Tom,

Thought about that one or simply trying to catch the error in my site wide
error handler, will give it a try, thanks.


-- Phil.

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: 08 March 2004 15:53
> To: PHP
> Subject: [PHP] Re: fsockopen() errors.
>
>
> On 8 Mar 2004 Phil Ewington - 43 Plc wrote:
>
> > Can anyone tell me the best way to avoid errors using
> fsockopen(). I have
> > tried wrapping the function call in a conditional statement,
> and have also
> > tried calling the function and then testing the return.
>
> Here's an approach I have used to avoid any error messages at all --
> presumably you could also set a flag in the error handler to indicate
> what happened, if you need that.
>
>   .
>
>   $olderr = error_reporting(0);
>   set_error_handler("ignoreerrhandler");
>   $fp = fsockopen(.)
>   restore_error_handler();
>   error_reporting($olderr);
>   if ($fp) {
>   [worked]
>   } else {
>   [failed]
>   }
>   .
>
>   function ignoreerrhandler($errno, $errstr, $errfile, $errline) {
>   return;
>   }
>
> --
> Tom
>
> --
> 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



[PHP] Re: fsockopen() errors.

2004-03-08 Thread trlists
On 8 Mar 2004 Phil Ewington - 43 Plc wrote:

> Can anyone tell me the best way to avoid errors using fsockopen(). I have
> tried wrapping the function call in a conditional statement, and have also
> tried calling the function and then testing the return.

Here's an approach I have used to avoid any error messages at all -- 
presumably you could also set a flag in the error handler to indicate 
what happened, if you need that.

.

$olderr = error_reporting(0);
set_error_handler("ignoreerrhandler");
$fp = fsockopen(.)
restore_error_handler();
error_reporting($olderr);
if ($fp) {
[worked]
} else {
[failed]
}
.

function ignoreerrhandler($errno, $errstr, $errfile, $errline) {
return;
}

--
Tom

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



[PHP] Re: fsockopen failed with permission denied error...

2004-02-20 Thread Scott Fletcher
Hi Justin!

Still have the same problem.  But that's okay, I decided not to use the
fsockopen() recently.  Because some people seem to have this problem too.
So, I'm pondering of doing a different way of using PHP.

FletchSOD

"Justin Patrin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Scott Fletcher wrote:
>
> > Hi Everyone!
> >
> > Sample code below...
> >
> > --snip--
> > $fp = fsockopen("www.cnn.com", 80, $errno, $errstr, 30);
> > --snip--
> >
> > I get the error message, permission denied along with 13.  When I read
the
> > bugs.php.net and found out that I need to add the "@" to it so I did
this..
> >
> > --snip--
> > $fp = @fsockopen("www.cnn.com", 80, $errno, $errstr, 30);
> > --snip--
> >
> > I get a different error message, it said ...
> >
> > --snip--
> > Addr family not supported by protocol (66)
> > --snip--
> >
> > Does anyone know what it meant and what is the workaround to it?
> >
> > Thanks,
> >  FletchSOD
>
> Try the example at: http://us4.php.net/fsockopen
>
> -- 
> --
> paperCrane 

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



[PHP] Re: fsockopen failed with permission denied error...

2004-02-19 Thread Justin Patrin
Scott Fletcher wrote:

Hi Everyone!

Sample code below...

--snip--
$fp = fsockopen("www.cnn.com", 80, $errno, $errstr, 30);
--snip--
I get the error message, permission denied along with 13.  When I read the
bugs.php.net and found out that I need to add the "@" to it so I did this..
--snip--
$fp = @fsockopen("www.cnn.com", 80, $errno, $errstr, 30);
--snip--
I get a different error message, it said ...

--snip--
Addr family not supported by protocol (66)
--snip--
Does anyone know what it meant and what is the workaround to it?

Thanks,
 FletchSOD
Try the example at: http://us4.php.net/fsockopen

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


[PHP] Re: fsockopen to conect to ssl sites

2004-01-05 Thread Manuel Lemos
Hello,

On 01/03/2004 03:06 PM, Jorge Castaneda wrote:
WHERE IS THE ERROR?
 
The  username  and  the  password  are the correct and the name of the
variables  (login  and  pass)  also  match. I tried to get data from a
secure  site but I always receive the next message instead of the page
I request:
 
We are connected with somesecuredomain.com
 
HTTP/1.1  302  Found  Date:  Fri,  02  Jan  2004  19:21:20 GMT Server:
Apache/1.3.27 (Unix) FrontPage/5.0.2.2623 PHP/4.3.2 mod_gzip/1.3.19.1a
mod_accounting/1.0   mod_fastcgi/2.4.0  mod_ssl/2.8.14  OpenSSL/0.9.7b
rus/PL30.17 X-Powered-By: PHP/4.3.2Set-Cookie:
biz=8a204f6cf271a7a81d3de70c0b250921; path=/ Expires: Thu, 01 Jan 1970
00:00:01   GMT  Cache-Control:  no-store,  no-cache,  must-revalidate,
post-check=0,  pre-check=0  Pragma: no-cache Location:
/?error=Auth+error%2C+wrong+login+or+password.&login=myusername
Connection:   close   Content-Type:   text/html;  charset=windows-1251
Last-Modified: Fri, 02 Jan 2004 19:21:20 GMT
These are headers to redirect you to a login page. You are probably not 
sending any session cookies that let the site reckon you as logged user. 
In that case, you need to submit a login form and collect the cookies to 
be used in the pages that you want to access.

You may want to try this class that can do that work of collecting 
cookies and sending them back when accessing the site pages. There is an 
example to do that in the same site where the class is available.

http://www.phpclasses.org/httpclient

--

Regards,
Manuel Lemos
Free ready to use OOP components written in PHP
http://www.phpclasses.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: fsockopen()

2003-09-30 Thread Cameron Metzke
Ima having problems myself with this, i dont seem to get errors when
entering an invalid .com or .net name i put it down to verisign hijacking
invalid somains?? could this be your problem?
"Phil Ewington - 43 Plc" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi All,
>
> I am having problems with fsockopen() and wondered if anyone else has
> encountered this behaviour. My problem is that when connecting to an
invalid
> domain I cannot trap the errors.
>
> I have tried setting a variable then testing the value, which prints a
> warning to the screen...
>
> $sck_handle = fsockopen($hostname, $port, $errno, $errstr, $timeout);
> if (!$sck_handle)
> {
> // socket could not be opened.
> $http_statuscode = "Error:" . $errno . "-" . $errstr;
> }
> else
> {
> ...
> }
>
> How can I get $errno & $errstr, are these for read/write errors rather
than
> socket initialisation? I need to know why the socket could not be opened
so
> I can give an appropriate error message.
>
> TIA
>
>
> Phil Ewington - Technical Director
> --
> 43 Plc
> 35 Broad Street, Wokingham
> Berkshire RG40 1AU
> T: +44 (0)118 978 9500
> F: +44 (0)118 978 4994
> E: mailto:[EMAIL PROTECTED]
> W: http://www.43plc.com

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



Re: [PHP] Re: fsockopen/ssl

2003-08-14 Thread Wendy Reetz
AHAH!  Thank you for your help.  You mentioned that the private key was missing.  I 
didn't realize I was generating a private key! (ok, I'm not new to php, but definitely 
new to the whole system configuration, apache, ssl side of things).  So, in looking 
into that I found that I hadn't restarted apache in ssl mode, when I tried I found 
that failed with the same error.  added some missing directives to the conf file & it 
started right up & is working great! 
Thank you for the point in the right direction!

Wendy

"Scott Fletcher" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Try "https://"; instead of "ssl://", this is what is normally done.
> 
> As for your problem.  It look like the private key when generated was too
> short, this can be overcomed by entering more characters at the time of the
> generation of hte key.  But from your comments, you mentioned that from the
> article at OpenSSL that it either not exist or is too short and that you
> mentioned that you have both.  So, if this is the case, then it seem that it
> had nothing to do with being too short.  Just that there is no key, so that
> in turn is too short because it isn't there.
> 
> I don't have an idea of what is going on.
> 
> "Wendy Reetz" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> Using php 4.3.2, apache 1.3.27, openssl .9.7b
> 
> I'm trying to open a secure connection using fsockopen("ssl://"...,443...)
> as described in http://us4.php.net/manual/en/function.fsockopen.php.
> 
> I keep getting an error:  PRNG not seeded.
> OpenSSL says http://www.openssl.org/support/faq.html#USER1 says:
> If the default seeding file [/dev/random or /dev/urandom] does not exist or
> is too short, the "PRNG not seeded" error message may occur.
> Now, both of these exist, but I'm not sure how to tell if they are too
> short...
> 
> has anyone used fsockopen("ssl://"...) successfully?  I've read through the
> php site, apache, and openssl...but I'm not finding a solution.  Is there
> something that may have been overlooked when the 3 were compiled?  Do you
> need to create a certificate?
> 
> The answer may be staring me right in the face & I'm just not seeing it.Any
> point in the right direction would be appreciated.
> 
> Thanks,
> 
> Wendy
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

[PHP] Re: fsockopen/ssl

2003-08-14 Thread Scott Fletcher
Try "https://"; instead of "ssl://", this is what is normally done.

As for your problem.  It look like the private key when generated was too
short, this can be overcomed by entering more characters at the time of the
generation of hte key.  But from your comments, you mentioned that from the
article at OpenSSL that it either not exist or is too short and that you
mentioned that you have both.  So, if this is the case, then it seem that it
had nothing to do with being too short.  Just that there is no key, so that
in turn is too short because it isn't there.

I don't have an idea of what is going on.

"Wendy Reetz" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Using php 4.3.2, apache 1.3.27, openssl .9.7b

I'm trying to open a secure connection using fsockopen("ssl://"...,443...)
as described in http://us4.php.net/manual/en/function.fsockopen.php.

I keep getting an error:  PRNG not seeded.
OpenSSL says http://www.openssl.org/support/faq.html#USER1 says:
If the default seeding file [/dev/random or /dev/urandom] does not exist or
is too short, the "PRNG not seeded" error message may occur.
Now, both of these exist, but I'm not sure how to tell if they are too
short...

has anyone used fsockopen("ssl://"...) successfully?  I've read through the
php site, apache, and openssl...but I'm not finding a solution.  Is there
something that may have been overlooked when the 3 were compiled?  Do you
need to create a certificate?

The answer may be staring me right in the face & I'm just not seeing it.Any
point in the right direction would be appreciated.

Thanks,

Wendy



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



Re: [PHP] Re: fsockopen/ssl

2003-08-14 Thread Scott Fletcher
Great!  Glad to hear it is working.  Apache conf file can be a haunting task
if we try new things as never before.

"Wendy Reetz" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
AHAH!  Thank you for your help.  You mentioned that the private key was
missing.  I didn't realize I was generating a private key! (ok, I'm not new
to php, but definitely new to the whole system configuration, apache, ssl
side of things).  So, in looking into that I found that I hadn't restarted
apache in ssl mode, when I tried I found that failed with the same error.
added some missing directives to the conf file & it started right up & is
working great!
Thank you for the point in the right direction!

Wendy

"Scott Fletcher" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Try "https://"; instead of "ssl://", this is what is normally done.
>
> As for your problem.  It look like the private key when generated was too
> short, this can be overcomed by entering more characters at the time of
the
> generation of hte key.  But from your comments, you mentioned that from
the
> article at OpenSSL that it either not exist or is too short and that you
> mentioned that you have both.  So, if this is the case, then it seem that
it
> had nothing to do with being too short.  Just that there is no key, so
that
> in turn is too short because it isn't there.
>
> I don't have an idea of what is going on.
>
> "Wendy Reetz" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> Using php 4.3.2, apache 1.3.27, openssl .9.7b
>
> I'm trying to open a secure connection using fsockopen("ssl://"...,443...)
> as described in http://us4.php.net/manual/en/function.fsockopen.php.
>
> I keep getting an error:  PRNG not seeded.
> OpenSSL says http://www.openssl.org/support/faq.html#USER1 says:
> If the default seeding file [/dev/random or /dev/urandom] does not exist
or
> is too short, the "PRNG not seeded" error message may occur.
> Now, both of these exist, but I'm not sure how to tell if they are too
> short...
>
> has anyone used fsockopen("ssl://"...) successfully?  I've read through
the
> php site, apache, and openssl...but I'm not finding a solution.  Is there
> something that may have been overlooked when the 3 were compiled?  Do you
> need to create a certificate?
>
> The answer may be staring me right in the face & I'm just not seeing
it.Any
> point in the right direction would be appreciated.
>
> Thanks,
>
> Wendy
>
>
>
> -- 
> 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



[PHP] Re: fsockopen proxy?

2002-09-06 Thread :B nerdy

its failing before i can even authorize myself for use in the proxy at
if ($fs = fsockopen("wwp.icq.com",80)) {

what must i do?? :/ the proxy is on port 8080?
cheers

":B Nerdy" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> im unable to access the web without first authenticating with the proxy.
how
> can i still use fsockopen and authenticate myself with php?
>
> cheers
>
>



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




Re: [PHP] Re: fsockopen and HTTP/1.1???

2002-07-01 Thread Chris Shiflett

Richard Lynch wrote:

>Secondly, I think it's probably just a Bad Idea (tm) to try to force HTTP to
>do 2 files in one connection anyway -- It just complicates your life, and is
>giving you headaches already...  How much worse will it get in a year?
>

Actually, it's a very good idea and very well supported. Even with 
HTTP/1.0, Web servers support persistent connections; the client simply 
has to ask for it with the "Connection: Keep-Alive" header. In HTTP/1.1 
(obviously the Web server he was dealing with), you have to ask for the 
server to close the connection with a "Connection: Close" header, 
because persistent connections are the default behavior.

>That said, I suspect that fgets() is looking for a particular character all
>by itself on a line that determines the end of a file.  Control-D, possibly.
>So, *MAYBE* sending a chr(4) (control-D) after each file will work...
>

The problem has nothing to do with fgets actually. If the Web server 
doesn't close the connection, the client doesn't close the connection, 
and the client endlessly loops waiting for more content, it's going to 
hang. That's to be expected. :)

>Disclaimer:  I'm not promising any of this is correct -- mostly guess-work
>here.
>

I explained this more thoroughly here:
http://marc.theaimsgroup.com/?l=php-general&m=102522127531834&w=2

Cheers.

Chris



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




[PHP] Re: fsockopen and HTTP/1.1???

2002-07-01 Thread Richard Lynch

In article <[EMAIL PROTECTED]> , [EMAIL PROTECTED] (Alex
Elderson) wrote:

>open connection to webapps.hardinxveld.netflex.nl oke
>
>  get / done
>  get / failt
>
>Closing connection to webapps.hardinxveld.netflex.nl oke
>
>
>The problem is the "Connection: Close\n\n" header. The webserver close the 
>connection after the first request, if i remove 
>the "Connection: Close\n\n" header the first fgets($web_conn, 128) command 
>will never ends.
>
>It's running on winXP apache 2.0.36 PHP 4.2.1 (test server) from the shell

First of all, you need to be aware that a web-server is not required to
respond using HTTP/1.1 just because you asked for it...  If the web-server
don't feel like doing HTTP/1.1, it can fall back to HTTP/1.0 in its
response.
[At least, that's how I understand it...]

So this whole multiple-file thingie may not work if, as I suspect, HTTP/1.0
doesn't support multiple files in one connection.

Secondly, I think it's probably just a Bad Idea (tm) to try to force HTTP to
do 2 files in one connection anyway -- It just complicates your life, and is
giving you headaches already...  How much worse will it get in a year?

That said, I suspect that fgets() is looking for a particular character all
by itself on a line that determines the end of a file.  Control-D, possibly.
 So, *MAYBE* sending a chr(4) (control-D) after each file will work...

Even if it does work, I still think it's a Bad Idea -- I'm not sure fgets()
is DOCUMENTED to use the Control-D, so there's no guarantee it will keep
working.  More headaches next week/month/year.

Disclaimer:  I'm not promising any of this is correct -- mostly guess-work
here.

-- 
Like Music?  http://l-i-e.com/artists.htm


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




Re: [PHP] Re: fsockopen

2002-05-16 Thread Jason Wong

On Thursday 16 May 2002 21:31, Henry Grech-Cini wrote:
> I'm confused!
>
> Did you want to make a new post for this comment or a reply to another
> post. Or does it in some way relate to my question. On my newsgroup browser
> it appears as if this post is in the wrong place! In answer to my post on
> "Newlines in fputs"

Lazy person replied to an existing post instead start a new one. Messes up 
threading for everyone.

> Thanks for responding anyway.

Probably not :)

> "Scott St. John" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> > I am using fsockopen to test several of our SQL and WEB servers at our
> > office.  Testing ports 80, 1433 and 8080 work fine, but I would like to
> > set something up to test ports on our mainframe.  These are printers
> > listening on 9100 and when I test it fails.  I don't see anything in the
> > online docs about going above a certain port - or is there something
> > else.
> >
> > Thanks,
> >
> > -Scott

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Sin has many tools, but a lie is the handle which fits them all.
*/


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




[PHP] Re: fsockopen

2002-05-16 Thread Henry Grech-Cini

I'm confused!

Did you want to make a new post for this comment or a reply to another post.
Or does it in some way relate to my question. On my newsgroup browser it
appears as if this post is in the wrong place! In answer to my post on
"Newlines in fputs"

Thanks for responding anyway.

Henry

"Scott St. John" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am using fsockopen to test several of our SQL and WEB servers at our
> office.  Testing ports 80, 1433 and 8080 work fine, but I would like to
> set something up to test ports on our mainframe.  These are printers
> listening on 9100 and when I test it fails.  I don't see anything in the
> online docs about going above a certain port - or is there something else.
>
> Thanks,
>
> -Scott
>
>



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




[PHP] Re: fsockopen timeout

2002-02-15 Thread Peter Clarke

OK I've found it...
The time out value is a FLOAT. So a timeout of 1 second is 1.0.
Strange since the examples in the manual are integers.

Anyway this works:
$socket = fsockopen($urlArray["host"], $urlArray["port"], &$errnum,
&$errstr, 1.0);

"Peter Clarke" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> According to the manual;
> http://www.php.net/manual/en/function.fsockopen.php
> Depending on the environment, optional connect timeout may not be
available.
>
> Does anyone know what environment is needed for it to be available?
> I have Redhat Linux 7.1 - and the timeout doen't seem to work.
>
> Any ideas?
>
> Peter
>


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




[PHP] Re: fsockopen nntp stalls

2001-12-26 Thread David

 hmm, does it work with smaller newsgroups? such as php\'s one which have ~30 groups.

when i wrote my own reader (using fsockopen also), i found that stalls are usually 
because of my own error(eg, article not found, etc)

you can take a peek at jim winstead\'s code from http://lists.php.net/snapshot.tar.gz 
it\'s the code powering http://lists.php.net. i learnt a lot from reading his code!

Good Luck!
>For example: server A may have 90,000 groups to list and >stalls after transferring 
>70,000 or so. On the other hand, >server B may have only 300 groups to list and 
>stalls after >250. 

-- 
PHP General 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] Re: fsockopen() prob

2001-11-29 Thread Yura

Nop, doesn't work - the same result, supplied argument is not valid 
file handler...

Youri

> Global variables are not really global in php because they are not
> available from within functions unless you specifically declare them
> as global.  This should work:
> 
> 130   function get_line {
> 131   global $socket_open;
> 132   $buffer = fgets($socket_open,500);
> 133   $buffer = eregi_replace("(\r|\n)","",$buffer);
> 134   return $buffer;
> 135   }
> 
> Fred
> 
> Yura <[EMAIL PROTECTED]> wrote in message
> 3C054EE3.19234.2726172@localhost">news:3C054EE3.19234.2726172@localhost...
> > I have a global variable
> > $socket_open = fsockopen($pop_server, 110,  $errno, $errstr, 60 );
> > then I define the function:
> >
> > 130   function get_line {
> > 131   $buffer = fgets($socket_open,500);
> > 132   $buffer = eregi_replace("(\r|\n)","",$buffer);
> > 133   return $buffer;
> > 134   }
> >
> > Here I've got the prob - it doesn't work, it sais: Warning: Supplied
> argument is not a valid File-
> > Handle resource in .../inc/pop-functions.inc on line 131
> >
> > At the same time $socket_open returns "Resource id #2" I don't know
> > what
> it means, could
> > anyone help me with it?
> >
> > Youri
> >
> >
> >
> >
> > <>< <>< <>< <>< God is our provider ><> ><> ><> ><>
> > http://www.body-builders.org
> >
> >
> 
> 
> 

<>< <>< <>< <>< God is our provider ><> ><> ><> ><> 
http://www.body-builders.org



-- 
PHP General 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] Re: fsockopen() prob

2001-11-28 Thread Fred

Global variables are not really global in php because they are not available
from within functions unless you specifically declare them as global.  This
should work:

130   function get_line {
131   global $socket_open;
132   $buffer = fgets($socket_open,500);
133   $buffer = eregi_replace("(\r|\n)","",$buffer);
134   return $buffer;
135   }

Fred

Yura <[EMAIL PROTECTED]> wrote in message
3C054EE3.19234.2726172@localhost">news:3C054EE3.19234.2726172@localhost...
> I have a global variable
> $socket_open = fsockopen($pop_server, 110,  $errno, $errstr, 60 );
> then I define the function:
>
> 130   function get_line {
> 131   $buffer = fgets($socket_open,500);
> 132   $buffer = eregi_replace("(\r|\n)","",$buffer);
> 133   return $buffer;
> 134   }
>
> Here I've got the prob - it doesn't work, it sais: Warning: Supplied
argument is not a valid File-
> Handle resource in .../inc/pop-functions.inc on line 131
>
> At the same time $socket_open returns "Resource id #2" I don't know what
it means, could
> anyone help me with it?
>
> Youri
>
>
>
>
> <>< <>< <>< <>< God is our provider ><> ><> ><> ><>
> http://www.body-builders.org
>
>



-- 
PHP General 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]