Re: [PHP] fsockopen in phpmailer and tls

2008-09-07 Thread Larry Brown
On Sat, 2008-09-06 at 14:53 -0400, Robert Cummings wrote:
 On Sat, 2008-09-06 at 14:38 -0400, Larry Brown wrote:
  On Sat, 2008-09-06 at 14:06 -0400, Robert Cummings wrote: 
   On Sat, 2008-09-06 at 14:02 -0400, Larry Brown wrote:
   
OK.  So I broke down and re-created my mail server due to its age.  I
am
now running the latest sendmail and it is still failing.  The message
in
the sendmail log is 

...remoteMachineIP] did not issue MAIL/EXPN/VRFY/ETRN during
connection to MTA

A little research is leading me to believe the client (php client
script) opened the socket but didn't send anything.  Now the
certificate
that I'm using for the server is a self signed certificate.  Evolution
asked if I wanted to accept the certificate when I first connected and
I
did.  After which it worked fine.  Is there a setting I must enable to
accept unknown certificates when a site is first connected to?

Any other ideas?
   
   Sounds like an email client issue and most likely may differ for each
   and every one of them.
   
   Cheers,
   Rob.
   -- 
  
  
  I am the email client.  In this case which is what I'm trying to figure
  out.  The script fails with the original string I posted:
  
  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'm using the smtpmailer class and it is trying to execute fsockopen.
  So to simplify troubleshooting I used the following code:
  
  if(fsockopen(tls://serverName,25,$errno,$errstr, 30))
  {
  echo Made it!\n;
  }
  else
  {
  echo Nope!\n;
  echo $errno.\n;
  echo $errstr.\n;
  }
  
  I get the above warning from PHP and $errno has 0 as a value and there
  is $errstr is empty.
  
  PHP is v5.2.6 and phpinfo shows that ssl and tls support are both
  compiled in.
 
 Ah, I see, I misunderstood when you mentioned Evolution. Sorry, I can't
 really help you, you're in foreign territory to me :/
 
 Cheers,
 Rob.

For posterity and to thank Robert...

I have determined that the mechanism in PHP does not allow you to
specify tls for a connection that initially starts off as a clear text
connection.  When you set up sendmail to use tls for smtp auth it allows
a connecting client to send connection details specifying tls at which
point it will start talking tls.  PHP expects the connection to be
dedicated tls.  So if you specify in sendmail to use a separate port for
tls and you point PHP to that port it works like a champ.

Thanks to Robert for at least giving it a shot.  Hopefully this will be
helpful to the next poor soul...

Larry



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



Re: [PHP] fsockopen in phpmailer and tls

2008-09-06 Thread Larry Brown
On Fri, 2008-09-05 at 00:58 -0400, Robert Cummings wrote:
 On Thu, 2008-09-04 at 23:20 -0400, Larry Brown wrote:
  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've googled this and someone seems very knowledgeable about it yet
  describes the solution in a way that a mere mortal like myself can't
  follow.  He states in part:
  
  Look at the error message:
  error:1408F10B:SSL routines:func(143):reason(267)
  
  Take the reason code (267) and determine the error:
  grep 267 /usr/include/openssl/ssl.h
  /usr/include/openssl/ssl.h:#define SSL_R_WRONG_VERSION_NUMBER   
  267
  
  Now google for SSL_R_WRONG_VERSION_NUMBER...
  
  ...So in your server method configuration you must put:
SSL_CTX *ctx = SSL_CTX_new (SSLv23_server_method())
  to correctely analyse the first client_hello message
  instead of 
SSL_CTX *ctx = SSL_CTX_new (SSLv3_server_method())
  which i suppose you did
  
  So is he talking about modifying the source code in postfix and 
  rebuilding it?  Have any of you guys dealt with this?...
  
  By the way, when I started out I had a typo in the postfix 
  config for the path to the certificates for ssl and was getting 
  the same error message.  It wasn't until I saw in the postfix 
  mail log that it couldn't read the cert.  So that was fixed but 
  I continue to get the same message which I'm now thinking might 
  be a red herring.
 
 Possibly a complete waste of your time... but maybe you need to
 configure this setting:
 
 smtp_tls_mandatory_protocols
 
 http://www.postfix.org/postconf.5.html
 
 Cheers,
 Rob.
 -- 


OK.  So I broke down and re-created my mail server due to its age.  I am
now running the latest sendmail and it is still failing.  The message in
the sendmail log is 

...remoteMachineIP] did not issue MAIL/EXPN/VRFY/ETRN during
connection to MTA

A little research is leading me to believe the client (php client
script) opened the socket but didn't send anything.  Now the certificate
that I'm using for the server is a self signed certificate.  Evolution
asked if I wanted to accept the certificate when I first connected and I
did.  After which it worked fine.  Is there a setting I must enable to
accept unknown certificates when a site is first connected to?

Any other ideas?


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



Re: [PHP] fsockopen in phpmailer and tls

2008-09-06 Thread Robert Cummings
On Sat, 2008-09-06 at 14:02 -0400, Larry Brown wrote:

 OK.  So I broke down and re-created my mail server due to its age.  I
 am
 now running the latest sendmail and it is still failing.  The message
 in
 the sendmail log is 
 
 ...remoteMachineIP] did not issue MAIL/EXPN/VRFY/ETRN during
 connection to MTA
 
 A little research is leading me to believe the client (php client
 script) opened the socket but didn't send anything.  Now the
 certificate
 that I'm using for the server is a self signed certificate.  Evolution
 asked if I wanted to accept the certificate when I first connected and
 I
 did.  After which it worked fine.  Is there a setting I must enable to
 accept unknown certificates when a site is first connected to?
 
 Any other ideas?

Sounds like an email client issue and most likely may differ for each
and every one of them.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] fsockopen in phpmailer and tls

2008-09-06 Thread Larry Brown
On Sat, 2008-09-06 at 14:06 -0400, Robert Cummings wrote: 
 On Sat, 2008-09-06 at 14:02 -0400, Larry Brown wrote:
 
  OK.  So I broke down and re-created my mail server due to its age.  I
  am
  now running the latest sendmail and it is still failing.  The message
  in
  the sendmail log is 
  
  ...remoteMachineIP] did not issue MAIL/EXPN/VRFY/ETRN during
  connection to MTA
  
  A little research is leading me to believe the client (php client
  script) opened the socket but didn't send anything.  Now the
  certificate
  that I'm using for the server is a self signed certificate.  Evolution
  asked if I wanted to accept the certificate when I first connected and
  I
  did.  After which it worked fine.  Is there a setting I must enable to
  accept unknown certificates when a site is first connected to?
  
  Any other ideas?
 
 Sounds like an email client issue and most likely may differ for each
 and every one of them.
 
 Cheers,
 Rob.
 -- 


I am the email client.  In this case which is what I'm trying to figure
out.  The script fails with the original string I posted:

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'm using the smtpmailer class and it is trying to execute fsockopen.
So to simplify troubleshooting I used the following code:

if(fsockopen(tls://serverName,25,$errno,$errstr, 30))
{
echo Made it!\n;
}
else
{
echo Nope!\n;
echo $errno.\n;
echo $errstr.\n;
}

I get the above warning from PHP and $errno has 0 as a value and there
is $errstr is empty.

PHP is v5.2.6 and phpinfo shows that ssl and tls support are both
compiled in.


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



Re: [PHP] fsockopen in phpmailer and tls

2008-09-06 Thread Robert Cummings
On Sat, 2008-09-06 at 14:38 -0400, Larry Brown wrote:
 On Sat, 2008-09-06 at 14:06 -0400, Robert Cummings wrote: 
  On Sat, 2008-09-06 at 14:02 -0400, Larry Brown wrote:
  
   OK.  So I broke down and re-created my mail server due to its age.  I
   am
   now running the latest sendmail and it is still failing.  The message
   in
   the sendmail log is 
   
   ...remoteMachineIP] did not issue MAIL/EXPN/VRFY/ETRN during
   connection to MTA
   
   A little research is leading me to believe the client (php client
   script) opened the socket but didn't send anything.  Now the
   certificate
   that I'm using for the server is a self signed certificate.  Evolution
   asked if I wanted to accept the certificate when I first connected and
   I
   did.  After which it worked fine.  Is there a setting I must enable to
   accept unknown certificates when a site is first connected to?
   
   Any other ideas?
  
  Sounds like an email client issue and most likely may differ for each
  and every one of them.
  
  Cheers,
  Rob.
  -- 
 
 
 I am the email client.  In this case which is what I'm trying to figure
 out.  The script fails with the original string I posted:
 
 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'm using the smtpmailer class and it is trying to execute fsockopen.
 So to simplify troubleshooting I used the following code:
 
 if(fsockopen(tls://serverName,25,$errno,$errstr, 30))
 {
   echo Made it!\n;
 }
 else
 {
   echo Nope!\n;
   echo $errno.\n;
   echo $errstr.\n;
 }
 
 I get the above warning from PHP and $errno has 0 as a value and there
 is $errstr is empty.
 
 PHP is v5.2.6 and phpinfo shows that ssl and tls support are both
 compiled in.

Ah, I see, I misunderstood when you mentioned Evolution. Sorry, I can't
really help you, you're in foreign territory to me :/

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] fsockopen in phpmailer and tls

2008-09-04 Thread Robert Cummings
On Thu, 2008-09-04 at 23:20 -0400, Larry Brown wrote:
 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've googled this and someone seems very knowledgeable about it yet
 describes the solution in a way that a mere mortal like myself can't
 follow.  He states in part:
 
 Look at the error message:
 error:1408F10B:SSL routines:func(143):reason(267)
 
 Take the reason code (267) and determine the error:
 grep 267 /usr/include/openssl/ssl.h
 /usr/include/openssl/ssl.h:#define SSL_R_WRONG_VERSION_NUMBER   
 267
 
 Now google for SSL_R_WRONG_VERSION_NUMBER...
 
 ...So in your server method configuration you must put:
   SSL_CTX *ctx = SSL_CTX_new (SSLv23_server_method())
 to correctely analyse the first client_hello message
 instead of 
   SSL_CTX *ctx = SSL_CTX_new (SSLv3_server_method())
 which i suppose you did
 
 So is he talking about modifying the source code in postfix and 
 rebuilding it?  Have any of you guys dealt with this?...
 
 By the way, when I started out I had a typo in the postfix 
 config for the path to the certificates for ssl and was getting 
 the same error message.  It wasn't until I saw in the postfix 
 mail log that it couldn't read the cert.  So that was fixed but 
 I continue to get the same message which I'm now thinking might 
 be a red herring.

Possibly a complete waste of your time... but maybe you need to
configure this setting:

smtp_tls_mandatory_protocols

http://www.postfix.org/postconf.5.html

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] fsockopen + fputs

2008-05-18 Thread Stut

On 16 May 2008, at 00:04, debussy007 wrote:
I use fsockopen and fputs to call a distant URL, but I have the  
following

error :
The requested URL /registration/test was not found on this server.

This is my code:

$req =
'username=' . $usr . 'password=' . $pass .
'date_of_birth=' . $year . - . $month . - . $day .
'email=' . $email . 'country=' . $country;


You should be using urlencode on these variables, otherwise you could  
end up truncating the data.



$fp = fsockopen(www.example.com, 80, $errno, $errstr, 30);
if (!$fp) {
  echo $errstr ($errno)br\n;
} else {
$header = POST /registration/test HTTP/1.0\r\n;
$header .= Content-Type: application/x-www-form-urlencoded\r\n;
$header .= Content-Length:  . strlen($req) . \r\n\r\n;
fputs ($fp, $header . $req);

  while (!feof($fp)) {
echo fgets($fp, 1024);
  }
  fclose($fp);
}

However the path www.example.com/registration/test exists


By which I assume you mean it works in a browser. If not, make sure  
it works in a browser first.



so why does it says it cannot find the requested url ?


You probably need a Host header to direct the request to the right  
website. If you're going to be making manual HTTP requests I suggest  
you use Firebug or similar to examine the requests your browser is  
making. Even better read the HTTP spec, but I tend to be realistic in  
my expectations. Alternatively I'd recommend looking at using the Curl  
extension.


-Stut

--
http://stut.net/

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



Re: [PHP] fsockopen + fputs

2008-05-16 Thread Per Jessen
debussy007 wrote:

 However the path www.example.com/registration/test exists
 so why does it says it cannot find the requested url ?
 
 Any idea ? Thank you for any help !!

Take a look at the accesslog on www.example.com - that'll tell you
what's happening.


/Per Jessen, Zürich


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



Re: [PHP] fsockopen + fputs

2008-05-16 Thread Nathan Rixham

debussy007 wrote:

Hello,

I use fsockopen and fputs to call a distant URL, but I have the following
error : 
The requested URL /registration/test was not found on this server.


This is my code:

$req = 
	'username=' . $usr . 'password=' . $pass . 
	'date_of_birth=' . $year . - . $month . - . $day . 
	'email=' . $email . 'country=' . $country;


$fp = fsockopen(www.example.com, 80, $errno, $errstr, 30);
if (!$fp) {
echo $errstr ($errno)br\n;
} else {
$header = POST /registration/test HTTP/1.0\r\n;
$header .= Content-Type: application/x-www-form-urlencoded\r\n;
$header .= Content-Length:  . strlen($req) . \r\n\r\n;
fputs ($fp, $header . $req);

while (!feof($fp)) {
echo fgets($fp, 1024);
}
fclose($fp);
}

However the path www.example.com/registration/test exists
so why does it says it cannot find the requested url ?

Any idea ? Thank you for any help !!


try changing to
POST /registration/test/ HTTP/1.0\r\n

note the trailing slash on test
also if that fails try http/1.1

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



Re: [PHP] fsockopen problems

2007-06-22 Thread Tijnema

On 6/22/07, Ray [EMAIL PROTECTED] wrote:

hello,
I'm having some problems with fsockopen and was hopping for some help.
I try to connect to a host via fsockopen and I get getaddrinfo failed
errors, but if I try fsockopen with google, everything works.

sample test code
  $fp=fsockopen('apps.subname.domain.com/xml_2.4/xml.php',80,$errno,
$errstr);
   var_dump($errno);
   var_dump($errstr);
   $fp=fsockopen(000.00.00.000/xml_2.4/xml.php,80,$errno, $errstr);
   var_dump($errno);
   var_dump($errstr);
   $fp=fsockopen('www.google.ca',80,$errno, $errstr);
   var_dump($errno);
   var_dump($errstr);

(sorry for sanitizing, not my choice.)
I can ping the host from the server, and going to this site in a browser gives
the expected output.

Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
getaddrinfo failed: hostname nor servname provided, or not known
in /usr/local/www/apache22/data/index.php on line 119

Warning: fsockopen() [function.fsockopen]: unable to connect to
apps.subname.domain.com/xml_2.4/xml.php:80 (Unknown error)
in /usr/local/www/apache22/data/index.php on line 119
int(0) string(0) 

[note no error for google. should be here]

Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
getaddrinfo failed: hostname nor servname provided, or not known
in /usr/local/www/apache22/data/index.php on line 122

Warning: fsockopen() [function.fsockopen]: unable to connect to
000.00.00.000/xml_2.4/xml.php:80 (Unknown error)
in /usr/local/www/apache22/data/index.php on line 122
int(0) string(0)  int(0) string(0) 



With fsockopen you connect to a host, not to the host with full path...
This would work fine:
$fp=fsockopen('apps.subname.domain.com',80,$errno,
$errstr);
  var_dump($errno);
  var_dump($errstr);
Now you probably want to get that file, so you should do a fwrite:
fwrite($fp,GET /xml_2.4/xml.php HTTP/1.1\r\nHost:
apps.subname.domain.com\r\n\r\n);
*note: All above should be on one single line
Then, after you made a request, you can get the data with fread:
$data = fread($fp,102400); // 100KB of data max
This returns the page, including the headers!
If you only want data, you're better off using file_get_contents
function, like this:
$data = file_get_contents('apps.subname.domain.com/xml_2.4/xml.php);

Hope this helps ;)

Tijnema


--
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

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



Re: [PHP] fsockopen problems

2007-06-22 Thread Ray
On Friday 22 June 2007 10:59 am, Tijnema wrote:
 On 6/22/07, Ray [EMAIL PROTECTED] wrote:
  hello,
  I'm having some problems with fsockopen and was hopping for some help.
  I try to connect to a host via fsockopen and I get getaddrinfo failed
  errors, but if I try fsockopen with google, everything works.
 
  sample test code
$fp=fsockopen('apps.subname.domain.com/xml_2.4/xml.php',80,$errno,
  $errstr);
 var_dump($errno);
 var_dump($errstr);
 $fp=fsockopen(000.00.00.000/xml_2.4/xml.php,80,$errno, $errstr);
 var_dump($errno);
 var_dump($errstr);
 $fp=fsockopen('www.google.ca',80,$errno, $errstr);
 var_dump($errno);
 var_dump($errstr);
 
  (sorry for sanitizing, not my choice.)
  I can ping the host from the server, and going to this site in a browser
  gives the expected output.
 
  Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
  getaddrinfo failed: hostname nor servname provided, or not known
  in /usr/local/www/apache22/data/index.php on line 119
 
  Warning: fsockopen() [function.fsockopen]: unable to connect to
  apps.subname.domain.com/xml_2.4/xml.php:80 (Unknown error)
  in /usr/local/www/apache22/data/index.php on line 119
  int(0) string(0) 
 
  [note no error for google. should be here]
 
  Warning: fsockopen() [function.fsockopen]: php_network_getaddresses:
  getaddrinfo failed: hostname nor servname provided, or not known
  in /usr/local/www/apache22/data/index.php on line 122
 
  Warning: fsockopen() [function.fsockopen]: unable to connect to
  000.00.00.000/xml_2.4/xml.php:80 (Unknown error)
  in /usr/local/www/apache22/data/index.php on line 122
  int(0) string(0)  int(0) string(0) 

 With fsockopen you connect to a host, not to the host with full path...
 This would work fine:
 $fp=fsockopen('apps.subname.domain.com',80,$errno,
 $errstr);
var_dump($errno);
var_dump($errstr);
 Now you probably want to get that file, so you should do a fwrite:
 fwrite($fp,GET /xml_2.4/xml.php HTTP/1.1\r\nHost:
 apps.subname.domain.com\r\n\r\n);
 *note: All above should be on one single line
 Then, after you made a request, you can get the data with fread:
 $data = fread($fp,102400); // 100KB of data max
 This returns the page, including the headers!
 If you only want data, you're better off using file_get_contents
 function, like this:
 $data = file_get_contents('apps.subname.domain.com/xml_2.4/xml.php);

 Hope this helps ;)

 Tijnema

Thanks, that does help. Thats exactly what I was looking for.
Ray

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



Re: [PHP] fsockopen - how can I specify the local/source port

2007-04-18 Thread Richard Lynch
On Wed, April 18, 2007 5:48 am, Matt wrote:
 I am experimenting with the fsockopen function to send custom UDP
 packets.
 What I would like to do is to be able to nominate the LOCAL port that
 my UDP
 packet originates from. What happens currently is that when I execute
 my
 code below I get a random port 1023 allocated. What I want to be able
 to do
 is to fix the port to one that I specify.

 The code below works and I can see my packet being sent out to
 destination
 port 7077.  The 192.168.2.10 server is also watching for the source
 port of
 incoming traffic and will only respond if the source port is also
 7077.

 ?php
 $fp = fsockopen(udp://192.168.2.10, 7077, $errno, $errstr);
 if (!$fp) {
 echo ERROR: $errno - $errstrbr /\n;
 } else {
 fwrite($fp, Test\n);
 echo fread($fp, 26);
 fclose($fp);
 }
 ?

 Any ideas how I can achieve this?

I believe you can only get what you want by dropping down to the lower
level socket stuff:
http://php.net/sockets

There may be some new-fangled streams stuff that also does it, with
prettier code...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] fsockopen error messages

2006-11-06 Thread Richard Lynch
Depending on your php.ini settings, it may be set up to wait FOREVER
for a socket to open...

What $host?
What $port?

Is it public? Private?

Is there any authentication scheme in place?

We've got nothing to work with here to help you...

On Mon, November 6, 2006 2:58 pm, 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!

 ?
 $fp = fsockopen($host, $port, $errno, $errstr);

 if (!$fp) {
  echo fsock NOT opened!br/;
  echo Error: $errstr ($errno)br /\n;
 }
 ?

 Thanks,
 ~Philip

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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] fsockopen error messages

2006-11-06 Thread Philip Thompson
Ok, since my last post, I have slapped myself on the wrist. I made a  
newbie mistake. The function that I send the host, port, etc to was  
in the wrong order from an older version of the function I had. So...  
the port was MSIE... instead of 80. Way to go me! =\


Thanks Richard.

~Philip


On Nov 6, 2006, at 3:12 PM, Richard Lynch wrote:


Depending on your php.ini settings, it may be set up to wait FOREVER
for a socket to open...

What $host?
What $port?

Is it public? Private?

Is there any authentication scheme in place?

We've got nothing to work with here to help you...

On Mon, November 6, 2006 2:58 pm, 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!

?
$fp = fsockopen($host, $port, $errno, $errstr);

if (!$fp) {
 echo fsock NOT opened!br/;
 echo Error: $errstr ($errno)br /\n;
}
?

Thanks,
~Philip


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



Re: [PHP] fsockopen, openssl error

2006-01-20 Thread Richard Lynch
On Fri, January 20, 2006 7:38 am, 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?

Didja remember to include OpenSSL when you compiled PHP 4.4.2???

Check your phpinfo() and see if it's in there.

If it ain't, you ain't gonna be able to build an SSL context, cuz you
ain't got SSL in your PHP to start with...

-- 
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] Fsockopen error

2005-11-02 Thread Terence



Robert Prentice wrote:

snip

$reply = http_post(https://www.safetrustprocessing.com;, 80, / 


Isnt https supposed to run on port 443? (or other than 80) Just a guess


xml_order_processing.php, array(myXml = $xml));
function http_post ($server, $port, $url, $vars) {


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



Re: [PHP] Fsockopen error

2005-11-02 Thread Jochem Maas

Terence wrote:



Robert Prentice wrote:

snip

$reply = http_post(https://www.safetrustprocessing.com;, 80, / 



Isnt https supposed to run on port 443? (or other than 80) Just a guess


that is the default, but any port is allowed technically ... although putting
port 80 under SSL is probably going to cause you a headache sometime/somewhere.




xml_order_processing.php, array(myXml = $xml));
function http_post ($server, $port, $url, $vars) {





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



Re: [PHP] Fsockopen error

2005-11-02 Thread Robert Prentice

Even if i change it back to 443 i still get the error.

Robert

On Nov 2, 2005, at 9:54 AM, Jochem Maas wrote:


Terence wrote:


Robert Prentice wrote:
snip


$reply = http_post(https://www.safetrustprocessing.com;, 80, /

Isnt https supposed to run on port 443? (or other than 80) Just a  
guess




that is the default, but any port is allowed technically ...  
although putting
port 80 under SSL is probably going to cause you a headache  
sometime/somewhere.




xml_order_processing.php, array(myXml = $xml));
function http_post ($server, $port, $url, $vars) {



--
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



Re: [PHP] Fsockopen error

2005-11-02 Thread Jochem Maas

Robert Prentice wrote:

Even if i change it back to 443 i still get the error.


take another look at your initail error message... it indicates
a problem related to the machines nameserver/dns setting (specifically
IPv6).

I'm willing to bet it's nothing to do with php - your OS seems to at fault.
note that you never mention anything about what version of software you
are using or even what platform you are running on... I'll just assume
linux and the prerequisite knowledge:

does this work for you?:

wget -d -v --delete-after https://www.safetrustprocessing.com



Robert

On Nov 2, 2005, at 9:54 AM, Jochem Maas wrote:


Terence wrote:


Robert Prentice wrote:
snip


$reply = http_post(https://www.safetrustprocessing.com;, 80, /


Isnt https supposed to run on port 443? (or other than 80) Just a  guess



that is the default, but any port is allowed technically ...  although 
putting
port 80 under SSL is probably going to cause you a headache  
sometime/somewhere.




xml_order_processing.php, array(myXml = $xml));
function http_post ($server, $port, $url, $vars) {



--
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



Re: [PHP] Fsockopen error

2005-11-02 Thread Robert Prentice

I get this error:

wget -d -v --delete-after https://www.safetrustprocessing.com
Setting --verbose (verbose) to 1
Setting --delete-after (deleteafter) to 1
DEBUG output created by Wget 1.10.1 (Red Hat modified) on linux-gnu.

--17:15:16--  https://www.safetrustprocessing.com/
   = `index.html'
Resolving www.safetrustprocessing.com... 209.200.128.119
Caching www.safetrustprocessing.com = 209.200.128.119
Connecting to www.safetrustprocessing.com|209.200.128.119|:443...  
connected.

Created socket 3.
Releasing 0x081fb188 (new refcount 1).
Initiating SSL handshake.
Handshake successful; connected socket 3 to SSL handle 0x08210a50
certificate:
  subject: /C=US/O=www.safetrustprocessing.com/OU=https:// 
services.choicepoint.net/get.jsp?GT91812388/OU=See www.geotrust.com/ 
resources/cps (c)04/OU=Domain Control Validated - QuickSSL(R)/ 
CN=www.safetrustprocessing.com
  issuer:  /C=US/O=Equifax Secure Inc./CN=Equifax Secure Global  
eBusiness CA-1
ERROR: Certificate verification error for  
www.safetrustprocessing.com: unable to get local issuer certificate
To connect to www.safetrustprocessing.com insecurely, use `--no-check- 
certificate'.

Closed 3/SSL 0x8210a50
Unable to establish SSL connection.


On Nov 2, 2005, at 11:18 AM, Jochem Maas wrote:


Robert Prentice wrote:


Even if i change it back to 443 i still get the error.



take another look at your initail error message... it indicates
a problem related to the machines nameserver/dns setting (specifically
IPv6).

I'm willing to bet it's nothing to do with php - your OS seems to  
at fault.
note that you never mention anything about what version of software  
you

are using or even what platform you are running on... I'll just assume
linux and the prerequisite knowledge:

does this work for you?:

wget -d -v --delete-after https://www.safetrustprocessing.com



Robert
On Nov 2, 2005, at 9:54 AM, Jochem Maas wrote:


Terence wrote:



Robert Prentice wrote:
snip



$reply = http_post(https://www.safetrustprocessing.com;, 80, /


Isnt https supposed to run on port 443? (or other than 80) Just  
a  guess





that is the default, but any port is allowed technically ...   
although putting
port 80 under SSL is probably going to cause you a headache   
sometime/somewhere.





xml_order_processing.php, array(myXml = $xml));
function http_post ($server, $port, $url, $vars) {




--
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Fsockopen error

2005-11-02 Thread Jochem Maas

still no info on what your version of php etc.
but that output gives the impression it may not be the OS after all...

are you able to recompile php? (using the --no-ipv6 flag or whatever it 
mentioned
in the original php error message you posted).

I have no idea how 'invalid' certificates are handled when connecting
to an SSL enabled port ... maybe that's what really causing the problem

have you confirmed that grabbing stuff over normal http does work?...

// something like...
$er = http_post(http://www.php.net;, 80, / );

Robert Prentice wrote:

I get this error:

wget -d -v --delete-after https://www.safetrustprocessing.com
Setting --verbose (verbose) to 1
Setting --delete-after (deleteafter) to 1
DEBUG output created by Wget 1.10.1 (Red Hat modified) on linux-gnu.

--17:15:16--  https://www.safetrustprocessing.com/
   = `index.html'
Resolving www.safetrustprocessing.com... 209.200.128.119
Caching www.safetrustprocessing.com = 209.200.128.119
Connecting to www.safetrustprocessing.com|209.200.128.119|:443...  
connected.

Created socket 3.
Releasing 0x081fb188 (new refcount 1).
Initiating SSL handshake.
Handshake successful; connected socket 3 to SSL handle 0x08210a50
certificate:
  subject: /C=US/O=www.safetrustprocessing.com/OU=https:// 
services.choicepoint.net/get.jsp?GT91812388/OU=See www.geotrust.com/ 
resources/cps (c)04/OU=Domain Control Validated - QuickSSL(R)/ 
CN=www.safetrustprocessing.com
  issuer:  /C=US/O=Equifax Secure Inc./CN=Equifax Secure Global  
eBusiness CA-1
ERROR: Certificate verification error for  www.safetrustprocessing.com: 
unable to get local issuer certificate
To connect to www.safetrustprocessing.com insecurely, use `--no-check- 
certificate'.

Closed 3/SSL 0x8210a50
Unable to establish SSL connection.


On Nov 2, 2005, at 11:18 AM, Jochem Maas wrote:


Robert Prentice wrote:


Even if i change it back to 443 i still get the error.



take another look at your initail error message... it indicates
a problem related to the machines nameserver/dns setting (specifically
IPv6).

I'm willing to bet it's nothing to do with php - your OS seems to  at 
fault.

note that you never mention anything about what version of software  you
are using or even what platform you are running on... I'll just assume
linux and the prerequisite knowledge:

does this work for you?:

wget -d -v --delete-after https://www.safetrustprocessing.com



Robert
On Nov 2, 2005, at 9:54 AM, Jochem Maas wrote:


Terence wrote:



Robert Prentice wrote:
snip



$reply = http_post(https://www.safetrustprocessing.com;, 80, /


Isnt https supposed to run on port 443? (or other than 80) Just  a  
guess





that is the default, but any port is allowed technically ...   
although putting
port 80 under SSL is probably going to cause you a headache   
sometime/somewhere.





xml_order_processing.php, array(myXml = $xml));
function http_post ($server, $port, $url, $vars) {




--
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] fsockopen and session_start

2005-03-08 Thread Pedro Garre
*This message was transferred with a trial version of CommuniGate(tm) Pro*

It works now. Thanks Jason.

I had never realized that once $_SESSION is set, and if you are not going to 
modify it, the session could be closed. It does not seem a good programming 
practice, thou.

On Tuesday 08 March 2005 05:15, Jason Wong wrote:
 *This message was transferred with a trial version of CommuniGate(tm) Pro*

 On Monday 07 March 2005 22:02, Pedro Garre wrote:
  I am using fsockopen to simulate a POST to another page (test_post.php)
  within the same server.

 It's not clear how exactly you're executing your code. I suspect that you
 haven't closed the session before doing your simulated POST. Your order
 of execution should be something like:

   start session
   assign values to session
   close session
   do the simulated POST

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



Re: [PHP] fsockopen and session_start

2005-03-07 Thread Jason Wong
On Monday 07 March 2005 22:02, Pedro Garre wrote:

 I am using fsockopen to simulate a POST to another page (test_post.php)
 within the same server.

It's not clear how exactly you're executing your code. I suspect that you 
haven't closed the session before doing your simulated POST. Your order 
of execution should be something like:

  start session
  assign values to session
  close session
  do the simulated POST

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
New Year Resolution: Ignore top posted posts

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



Re: [PHP] fsockopen: fetching url

2005-02-13 Thread Bostjan Skufca @ domenca.com
HTTP 1.0 does not support virtual hosts.


B.




On Friday 11 February 2005 18:04, [EMAIL PROTECTED] wrote:
 I'm using code below to fetch content from the url.
 This code was worked properly on two servers I tested but it want worked on
 the
 designated one,  so after getting error message I figure it out it may
 be php.ini settings limitation
 ---
- The server encountered an internal
 error or misconfiguration and was unable to complete your request.
 Additionally, a 404 Not Found error was encountered while trying to use an
 ErrorDocument to handle the request.
 ---
-


 So here's the settings I found as possible reason for limitation on code
 execution.
 ---
- disable_functions: readfile, system,
 passthru, shell_exec, shell_exec, system, execreadfile, system, passthru,
 shell_exec, shell_exec, system, exec
 ---
- Does anybody hava any tip how to
 workarround on this?


 CODE
 ---
- function fetchURL( $url ) {
$url_parsed = parse_url($url);
$host = isset($url_parsed[host]) ? $url_parsed[host]: ;
$port = isset($url_parsed[port]) ? $url_parsed[port]: 0;
if ($port==0)
$port = 80;
$path = $url_parsed[path];

$query = isset($url_parsed[query]) ? $url_parsed[query]: ;

if ($query != )
$path .= ? . $query;

$out = GET $path HTTP/1.0\r\nHost: $host\r\n\r\n;

$fp = fsockopen($host, $port, $errno, $errstr, 30);

fwrite($fp, $out);
$body = false;
$in = ;
while (!feof($fp)) {
$s = fgets($fp, 1024);
if ( $body )
$in .= $s;
if ( $s == \r\n )
$body = true;
}

fclose($fp);

return $in;
 }
 ---
-

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



Re: [PHP] fsockopen: fetching url

2005-02-11 Thread Richard Lynch
[EMAIL PROTECTED] wrote:

 I'm using code below to fetch content from the url.
 This code was worked properly on two servers I tested but it want worked
 on
 the
 designated one,  so after getting error message I figure it out it may
 be php.ini settings limitation
 
 The server encountered an internal error or misconfiguration and was
 unable to complete your request.
 Additionally, a 404 Not Found error was encountered while trying to use
 an
 ErrorDocument to handle the request.

Do *ANY* PHP scripts work on that server?

?php phpinfo();?

is a good example to try.




 So here's the settings I found as possible reason for limitation on code
 execution.
 
 disable_functions: readfile, system, passthru, shell_exec, shell_exec,
 system, execreadfile, system, passthru, shell_exec, shell_exec, system,
 exec

Are you using any of those functions?...

I don't see them in your code.


 Does anybody hava any tip how to workarround on this?


 CODE
 
 function fetchURL( $url ) {
$url_parsed = parse_url($url);
$host = isset($url_parsed[host]) ? $url_parsed[host]: ;
$port = isset($url_parsed[port]) ? $url_parsed[port]: 0;
if ($port==0)
$port = 80;
$path = $url_parsed[path];

$query = isset($url_parsed[query]) ? $url_parsed[query]: ;

if ($query != )
$path .= ? . $query;

$out = GET $path HTTP/1.0\r\nHost: $host\r\n\r\n;

$fp = fsockopen($host, $port, $errno, $errstr, 30);

fwrite($fp, $out);
$body = false;
$in = ;
while (!feof($fp)) {
$s = fgets($fp, 1024);
if ( $body )
$in .= $s;
if ( $s == \r\n )
$body = true;
}

fclose($fp);

return $in;
 }


-- 
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] fsockopen

2005-02-02 Thread Bostjan Skufca @ domenca.com
Last two examples are fine as connection is obviously established, it is the  
communication with server that is causig an error. Read http protocol 
documentation.

You do not want such a degree of control over communication you can just use
file_get_contents($url);
where $url is 
http(s)://your.domain.net/dir/file... - standard url


regards,
Bostjan




On Tuesday 01 February 2005 18:17, pete M wrote:
 am not having a lot of success with opening a socket to a secure domain
 (php 4.3.8 - apache - openSSL)

 $fp = fsockopen($url , 443 ,$errno, $errstr, 30);

 have tried the following $urls

 ---
 $url = 'domain.net';

 Bad Request
 Your browser sent a request that this server could not understand.

 Reason: You're speaking plain HTTP to an SSL-enabled server port.
 Instead use the HTTPS scheme to access this URL, please.

 --
 $url = 'https://domain.net';

 Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name
 or service not known

 --
 $url = 'ssl://domain.net';

 Bad Request
 Your browser sent a request that this server could not understand.

 Client sent malformed Host header

 ---
 $url = 'tls://domain.net';

 Bad Request
 Your browser sent a request that this server could not understand.

 Client sent malformed Host header


 Am I missing the obvious as I cannot thing of any other options ;-((

 tia
 pete

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



Re: [PHP] fsockopen

2005-02-01 Thread Richard Lynch
pete M wrote:
 am not having a lot of success with opening a socket to a secure domain
 (php 4.3.8 - apache - openSSL)

 $fp = fsockopen($url , 443 ,$errno, $errstr, 30);

You would need to do S much work to get this going, generating
complementary two-way encryption keys...

Just use curl:

http://php.net/curl

-- 
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] fsockopen to own server

2004-12-22 Thread Doc
Thanks for your (and everyone else's) help so far.

I've given up on this. Got another one off the web which uses pop3 and
mail() to achieve the same thing.

Thanks anyway
Dave

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



Re: [PHP] fsockopen to own server

2004-12-20 Thread Doc
On Thu, 16 Dec 2004 10:02:02 -0800, Richard Lynch wrote:

 Doc wrote:
 I'm having a problem with fsockopen and was wondering has anyone ever
 noticed a case where it will work from machine1 (dev machine) to machine2.
 But when the was placed onto machine2 it wouldn't work connecting to it's
 own ip address;

 when connecting via telnet it returns:

  Escape character is '^]'.
 * OK [CAPABILITY IMAP4REV1 LOGIN-REFERRALS AUTH=LOGIN]
 serverip IMAP4rev1 2003.339-cpanel at Wed, 15 Dec 2004
 19:33:27 + (GMT)
 
 You *ARE* getting this when telnetting from/to the same machine, right?...

Yes. the same machine.

 so I don't think it's the firewall. the error it returns is No such file
 or directory. So it seems that when it connects (which it does without
 failing), the file seems to be deleted, as the file the variable refers to
 doesn't exist on the fs either.

 if(($s = fsockopen($id[sockname], 0, $errno, $errstr)) === FALSE)

 $id[sockname] is in the format /tmp/filename with the filename changing
 based on a random value and there are no files with that format in /tmp
 
 Despite the user contributed note on
 http://php.net/manual/en/transports.unix.php
 I'm wondering if you shouldn't use the unix:// bit -- and try udg:// as
 well, if that doesn't work.

Tried both without any success.

 Finally, if there are no files with that format in /tmp, how will this
 work?  Or is that how unix socket streams are supposed to work?  I'm
 ignorant in this area...  But it seems to me that if you try to open a
 file that's not there, you SHOULD get FALSE back. :-)

I'm as ignorant as you :) this is an ex-coworkers code. From
what I can tell from the file should be there from when it connects
initially (as that's the way it is when it's on the dev machine) but
they're not although there is no failure to connect, which suggests to me
that the file is deleted.

 it always returns false for some reason on this server.
 
 And what, if anything, are in $errno and $errstr?
 
 You've put them in there, you might as well use them :-)

$errno 2
$errstr No such file or directory

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



Re: [PHP] fsockopen to own server

2004-12-20 Thread Doc
On Thu, 16 Dec 2004 23:37:36 +0600, Raditha Dissanayake wrote:

 
 Escape character is '^]'.
* OK [CAPABILITY IMAP4REV1 LOGIN-REFERRALS AUTH=LOGIN]
serverip IMAP4rev1 2003.339-cpanel at Wed, 15 Dec 2004
19:33:27 + (GMT)

so I don't think it's the firewall. 

 usually a good idea to disable firewalls when having trouble with socket 
 code.

Tried that. didn't make any difference.

if(($s = fsockopen($id[sockname], 0, $errno, $errstr)) === FALSE)

$id[sockname] is in the format /tmp/filename with the filename changing
based on a random value and there are no files with that format in /tmp 

it always returns false for some reason on this server.
  

 not sure what you are trying to do but it sounds like you are using unix 
 domain sockets where you should be using tcp. That's why it might work 
 on one machine (where web and imap are both installed) and not on the 
 other where you only have the web server but the imap server is remote.

This is actually the opposite of what is happening. It will work on the
remote server but not the local one. I've tried using unix:// and it made
no difference.

Any other suggestions?

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



Re: [PHP] fsockopen to own server

2004-12-20 Thread Richard Lynch
Doc wrote:
 not sure what you are trying to do but it sounds like you are using unix
 domain sockets where you should be using tcp. That's why it might work
 on one machine (where web and imap are both installed) and not on the
 other where you only have the web server but the imap server is remote.

 This is actually the opposite of what is happening. It will work on the
 remote server but not the local one. I've tried using unix:// and it made
 no difference.

 Any other suggestions?

WILD GUESS ALERT!

What you got in /etc/hosts.allow and /etc/hosts.deny?...

Or any kind of other anti-bad-guy technology?...

Does it work if you use 127.0.0.1 for the IP/URL?
How about the actual IP of the machine?
localhost?

Just throwing out random things to try that might lead you somewhere.

-- 
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] fsockopen to own server

2004-12-20 Thread Doc
On Mon, 20 Dec 2004 07:51:46 -0800, Richard Lynch wrote:
 
 WILD GUESS ALERT!
 
 What you got in /etc/hosts.allow and /etc/hosts.deny?...

nothing in there other than default install comments.
 
 Or any kind of other anti-bad-guy technology?...

nope.

 Does it work if you use 127.0.0.1 for the IP/URL?
 How about the actual IP of the machine?
 localhost?

d) none of the above :)
 
 Just throwing out random things to try that might lead you somewhere.

much appreciated. I'm willing to sacrifice young lambs at this stage.

Cheers
Doc

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



Re: [PHP] fsockopen to own server

2004-12-20 Thread Richard Lynch
Doc wrote:
 On Mon, 20 Dec 2004 07:51:46 -0800, Richard Lynch wrote:

 WILD GUESS ALERT!

 What you got in /etc/hosts.allow and /etc/hosts.deny?...

 nothing in there other than default install comments.

 Or any kind of other anti-bad-guy technology?...

 nope.

 Does it work if you use 127.0.0.1 for the IP/URL?
 How about the actual IP of the machine?
 localhost?

 d) none of the above :)

 Just throwing out random things to try that might lead you somewhere.

 much appreciated. I'm willing to sacrifice young lambs at this stage.

Okay, pull out ethereal and netstat -a to see what connections are being
tried/attempted/whatever.

Maybe even tcpdump to see what is going back and forth.

If all else fails, here's a TOTAL HACK:

Write a PHP script on some other server that connects back to the first
server and opens the socket and does whatever you need it to do.

Now have your script connect to the other server and use its sockets to do
what you need.

This is clearly *NOT* a Good Idea for a long-term solution, but could get
you past this hump long enough to survive, and maybe even make you realize
just why the same-machine system doesn't work.

-- 
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] fsockopen to own server

2004-12-16 Thread Raditha Dissanayake
Doc wrote:
Hello.
I'm having a problem with fsockopen and was wondering has anyone ever
noticed a case where it will work from machine1 (dev machine) to machine2.
 

happens all the time :-)
But when the was placed onto machine2 it wouldn't work connecting to it's
own ip address; 

when connecting via telnet it returns:
Escape character is '^]'.
* OK [CAPABILITY IMAP4REV1 LOGIN-REFERRALS AUTH=LOGIN]
serverip IMAP4rev1 2003.339-cpanel at Wed, 15 Dec 2004
19:33:27 + (GMT)
so I don't think it's the firewall. 

usually a good idea to disable firewalls when having trouble with socket 
code.

the error it returns is No such file
or directory. So it seems that when it connects (which it does without
failing), the file seems to be deleted, as the file the variable refers to
doesn't exist on the fs either.
if(($s = fsockopen($id[sockname], 0, $errno, $errstr)) === FALSE)
$id[sockname] is in the format /tmp/filename with the filename changing
based on a random value and there are no files with that format in /tmp 

it always returns false for some reason on this server.
 

not sure what you are trying to do but it sounds like you are using unix 
domain sockets where you should be using tcp. That's why it might work 
on one machine (where web and imap are both installed) and not on the 
other where you only have the web server but the imap server is remote.

--
Raditha Dissanayake.
--
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/  | Drag and Drop Upload 

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


Re: [PHP] fsockopen to own server

2004-12-16 Thread Richard Lynch
Doc wrote:
 I'm having a problem with fsockopen and was wondering has anyone ever
 noticed a case where it will work from machine1 (dev machine) to machine2.
 But when the was placed onto machine2 it wouldn't work connecting to it's
 own ip address;

 when connecting via telnet it returns:

  Escape character is '^]'.
 * OK [CAPABILITY IMAP4REV1 LOGIN-REFERRALS AUTH=LOGIN]
 serverip IMAP4rev1 2003.339-cpanel at Wed, 15 Dec 2004
 19:33:27 + (GMT)

You *ARE* getting this when telnetting from/to the same machine, right?...

 so I don't think it's the firewall. the error it returns is No such file
 or directory. So it seems that when it connects (which it does without
 failing), the file seems to be deleted, as the file the variable refers to
 doesn't exist on the fs either.

 if(($s = fsockopen($id[sockname], 0, $errno, $errstr)) === FALSE)

 $id[sockname] is in the format /tmp/filename with the filename changing
 based on a random value and there are no files with that format in /tmp

Despite the user contributed note on
http://php.net/manual/en/transports.unix.php
I'm wondering if you shouldn't use the unix:// bit -- and try udg:// as
well, if that doesn't work.

Finally, if there are no files with that format in /tmp, how will this
work?  Or is that how unix socket streams are supposed to work?  I'm
ignorant in this area...  But it seems to me that if you try to open a
file that's not there, you SHOULD get FALSE back. :-)

 it always returns false for some reason on this server.

And what, if anything, are in $errno and $errstr?

You've put them in there, you might as well use them :-)

-- 
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] fsockopen https problem

2004-12-13 Thread Richard Lynch
Maycon de Oliveira wrote:
 Hi, i have problem in my script, this error is Permission Danied (13)

 ?

 $host = 193.132.139.36;

 $port = 443;

 $path = /gatekeeper/ink/quexry.asp; //or .dll, etc. for authnet, etc.

 $fp = fsockopen(https://.$host, $port, $errno, $errstr, $timeout = 10);

You can't just open up a socket on port 443 to a secure server and start
sending/getting data.

The whole point of SSL is that you need to provide a half of an SSH
key-pair, and get half of their key-pair, then you each generate a
key-pair from your secret half key-pairs, and then you swap those so you
each know the other has the secret half of the key-pair they gave you,
then you can send a new unique key-pair to encrypt/decrypt the data, and
then you can start sending the username/password back and forth safely to
be logged in, and then you can kiss each other...

You could, in theory, develop all of the code to implement this protocol
for yourself and use fsockopen as you are.

But it would be *WAY* mo' betta to just use this:

http://php.net/curl

Have fun.

PS Keep all the urlencode stuff you have -- That's all good.  Just the
fsockopen bit needs to change.

-- 
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] fsockopen connection error on IIS[Scanned]

2004-03-31 Thread Michael Egan
Problem solved. It seems there was a proxy server involved which was screwing things 
up.

Regards,

Michael Egan

 -Original Message-
 From: Michael Egan 
 Sent: 31 March 2004 14:20
 To: PHP General (E-mail)
 Subject: [PHP] fsockopen connection error on IIS[Scanned]
 
 
 Hello all,
 
 I'm working with somebody using IIS (honest - it's not me) to 
 try and develop some web services whereby a site hosted on 
 IIS is able to access data using a nusoap client with a 
 nusoap server set up on a linux/apache server. I can do this 
 satisfactorily from another linux/apache server but my 
 colleague is having problems doing this from IIS.
 
 The main problem seems to be that fsockopen isn't working 
 from their system. We have tried running the following script:
 
 ?php
 $fp = fsockopen(www.thehostname.com, 80, $errno, $errstr, 30);
 
 if (!$fp) 
 
 {
echo $errstr ($errno)br /\n;
 } 
 
 else 
 
 {
 
echo Success;
 
 }
 ? 
 
 But the following error is returned:
 
 Warning: fsockopen(): unable to connect to 
 www.thehostname.com:80 in 
 C:\Inetpub\wwwroot\webservice\fsocktest.php on line 2
 A connection attempt failed because the connected party did 
 not properly respond after a period of time, or established 
 connection failed because connected host has failed to 
 respond. (10060)
 
 I've searched through a few mailing list archives and the 
 only thing I came across was the suggestion that the client 
 server is not allowing outgoing connections. Is there any way 
 of testing this or indeed any other suggestions as to what 
 might be going wrong.
 
 I confess I feel I'm on extremely thin ice with this - I'm 
 not overly familiar with nusoap and have no familiarity 
 whatsoever with IIS. Any general pointers would be extremely welcome.
 
 Regards,
 
 Michael Egan
 
 -- 
 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



Re: [PHP] fsockopen and HTTP 1.1 Problem

2004-03-25 Thread Richard Davey
Hello Mooki,

Thursday, March 25, 2004, 12:26:27 PM, you wrote:

M I am using these to get the code of a page that is listed in the code
M below. I am using the example code of fsockopen on php.net as reference.
M I can get the response header but i have a problem with the CHUNKs.

You could save yourself a whole load of headaches by getting the free
class file Snoopy, that will do exactly what you want (and a lot
more)

http://snoopy.sourceforge.com

Then your code would just look like this:

?php
include Snoopy.class.php;
$snoopy = new Snoopy;
$submit_url = http://myplanetside.station.sony.com/outfit.jsp;;
$submit_vars[outfitId] = 6607;
$submit_vars[worldId] = 21;
$snoopy-submit($submit_url,$submit_vars);
?

Then the whole page is stored in $snoop-results, the headers in
$snoopy-headers, etc etc. Lots of variations, see the doc files.

:)

-- 
Best regards,
 Richard Davey
 http://www.phpcommunity.org/wiki/296.html

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



Re: [PHP] fsockopen and HTTP 1.1 Problem

2004-03-25 Thread Chris Shiflett
--- Mooki [EMAIL PROTECTED] wrote:
 I am using these to get the code of a page that is listed in the code 
 below. I am using the example code of fsockopen on php.net as
 reference.
 
 I can get the response header but i have a problem with the CHUNKs.

I can show you how to deal with chunked responses, but I think this is
unnecessary.

You can open a remote URL just as if it were a local file if
allow_url_fopen is enabled:

$handle = fopen('http://example.org/', 'r');
...

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] fsockopen to spit out the HTTP's Location...

2004-03-23 Thread Scott Fletcher
In plain english, can't use the header(Location: ), so have to use the
fsockopen() instead.  Just that header() is not allowed, don't ask me why.
Just couldn't get the browser perform the HTTP LOCATION event.  It does work
when using fsockopen() for HTTP POST or GET as stated in the
http://us2.php.net/manual/en/function.fsockopen.php with the user's comment.
What could be more difficult than this?

--snip--
$host = 192.168.0.2;
$port = 443;
$url_str = ssl://www.whatever.com?str1=truestr2=falsestr3=true;

$fp = fsockopen(ssl://.$host, $port, $errno, $errstr, $timeout = 30);

if(!$fp){
  echo $errstr ($errno)\n;
}else{
  //send out to the browser.
  fputs($fp, Location: .$url_str.\r\n);

  fclose($fp);
}

FletchSOD

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



Re: [PHP] fsockopen to spit out the HTTP's Location...

2004-03-23 Thread Scott Fletcher
In plain english, can't use the header(Location: ), so have to use the
fsockopen() instead.  Just that header() is not allowed, don't ask me why.
Just couldn't get the browser perform the HTTP LOCATION event.  It does work
when using fsockopen() for HTTP POST or GET as stated in the
http://us2.php.net/manual/en/function.fsockopen.php with the user's comment.
What could be more difficult than this?

--snip--
$host = 192.168.0.2;
$port = 443;
$url_str = ssl://www.whatever.com?str1=truestr2=falsestr3=true;

$fp = fsockopen(ssl://.$host, $port, $errno, $errstr, $timeout = 30);

if(!$fp){
  echo $errstr ($errno)\n;
}else{
  //send out to the browser.
  fputs($fp, Location: .$url_str.\r\n);

  fclose($fp);
}

FletchSOD

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



Re: [PHP] fsockopen to spit out the HTTP's Location...

2004-03-23 Thread Michal Migurski
In plain english, can't use the header(Location: ), so have to use
the fsockopen() instead.  Just that header() is not allowed, don't ask me
why. Just couldn't get the browser perform the HTTP LOCATION event.
--snip--
$host = 192.168.0.2;
$port = 443;
$url_str = ssl://www.whatever.com?str1=truestr2=falsestr3=true;

$fp = fsockopen(ssl://.$host, $port, $errno, $errstr, $timeout = 30);
--snip--
  //send out to the browser.
  fputs($fp, Location: .$url_str.\r\n);

That won't get sent to the browser, it will get sent to 192.168.0.2, which
is (I guess) some machine behind your router. You can't initiate a TCP
connection -- what fsockopen does -- with the client's machine.

I'll ask even though you said not to - Why doesn't header() work?

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



Re: [PHP] fsockopen to spit out the HTTP's Location...

2004-03-23 Thread Chris Shiflett
--- Scott Fletcher [EMAIL PROTECTED] wrote:
 In plain english, can't use the header(Location: ), so have to
 use the fsockopen() instead. Just that header() is not allowed, don't
 ask me why.

I'm asking anyway. :-)

You cannot (thank goodness) connect to a remote client with fsockopen(),
so you can probably save yourself some trouble by forgetting this whole
approach. You need to focus on why header() is not working for you,
because this is the way to send HTTP headers to the client.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] fsockopen to spit out the HTTP's Location...

2004-03-23 Thread Scott Fletcher
Boy!  Everyone here is itching for an answer!!!  :-)  Sigh!  Well, I guess
all web browsers suck at it by the way!!  Michal Migurski from other posting
had explained that fsockopen() do the TCP stuff or the Transport Layer.  So,
no wonder fsockopen() can't get to the Network layer, like the IP Address
stuff.  I'll think of a workaround to the header() instead.  I don't want to
use cURL because it take more time.  And finally, for those of you who are
dying to know the answer to why I can't use the header().  It's the 3rd
party coding that contain the code,

--snip--
if(headers_sent())
$this-Error('  ');
--snip--

FletchSOD

Chris Shiflett [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 --- Scott Fletcher [EMAIL PROTECTED] wrote:
  In plain english, can't use the header(Location: ), so have to
  use the fsockopen() instead. Just that header() is not allowed, don't
  ask me why.

 I'm asking anyway. :-)

 You cannot (thank goodness) connect to a remote client with fsockopen(),
 so you can probably save yourself some trouble by forgetting this whole
 approach. You need to focus on why header() is not working for you,
 because this is the way to send HTTP headers to the client.

 Chris

 =
 Chris Shiflett - http://shiflett.org/

 PHP Security - O'Reilly
  Coming Fall 2004
 HTTP Developer's Handbook - Sams
  http://httphandbook.org/
 PHP Community Site
  http://phpcommunity.org/

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



Re: [PHP] fsockopen to spit out the HTTP's Location...

2004-03-23 Thread Scott Fletcher
See the reply to the Chris Shiflett's reply...

Michal Migurski [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 In plain english, can't use the header(Location: ), so have to use
 the fsockopen() instead.  Just that header() is not allowed, don't ask me
 why. Just couldn't get the browser perform the HTTP LOCATION event.
 --snip--
 $host = 192.168.0.2;
 $port = 443;
 $url_str = ssl://www.whatever.com?str1=truestr2=falsestr3=true;
 
 $fp = fsockopen(ssl://.$host, $port, $errno, $errstr, $timeout = 30);
 --snip--
   //send out to the browser.
   fputs($fp, Location: .$url_str.\r\n);

 That won't get sent to the browser, it will get sent to 192.168.0.2, which
 is (I guess) some machine behind your router. You can't initiate a TCP
 connection -- what fsockopen does -- with the client's machine.

 I'll ask even though you said not to - Why doesn't header() work?

 -
 michal migurski- contact info and pgp key:
 sf/cahttp://mike.teczno.com/contact.html

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



Re: [PHP] fsockopen to spit out the HTTP's Location...

2004-03-23 Thread Michal Migurski
And finally, for those of you who are dying to know the answer to why I
can't use the header().  It's the 3rd party coding that contain the code,

--snip--
if(headers_sent())
$this-Error('  ');
--snip--

Why not delete that part of the 3rd party code then? Or send your Location
header before you call it? Curl won't help you here, for the same reasons
that fsockopen won't work.

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

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



Re: [PHP] fsockopen to spit out the HTTP's Location...

2004-03-23 Thread Chris Shiflett
--- Scott Fletcher [EMAIL PROTECTED] wrote:
 Sigh!  Well, I guess all web browsers suck at it by the way!

Suck at what exactly?

 Michal Migurski from other posting had explained that fsockopen()
 do the TCP stuff or the Transport Layer. So, no wonder fsockopen()
 can't get to the Network layer, like the IP Address stuff.

What do you consider to be the network layer? This figure might be helpful
to you:

http://shiflett.org/images/18fig06.jpg

 I don't want to use cURL because it take more time.

A better reason is that it also cannot make a connection to a remote
client.

 And finally, for those of you who are dying to know the answer to
 why I can't use the header(). It's the 3rd party coding that contain
 the code,
 
 --snip--
 if(headers_sent())
 $this-Error('  ');
 --snip--

Yeah, this is why everyone was interested - you're wrong. :-)

That code will throw an error is headers have already been sent. Headers
are sent as soon as output begins, so you can either set all of your
headers prior to any output or use output buffering with ob_start().

So, use header().

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] fsockopen to spit out the HTTP's Location...

2004-03-23 Thread Scott Fletcher
  Sigh!  Well, I guess all web browsers suck at it by the way!
 Suck at what exactly?
Not suck at receiving the HTTP commands from the webserver but suck at not
receiving the HTTP commands from the PHP.  :-)  I understand how the
browser/webserver communication work so no wonder why it doesn't work.  Kind
of make you jealous of the flash player that are both client and server side
on the web-browser

 What do you consider to be the network layer? This figure might be helpful
 to you: http://shiflett.org/images/18fig06.jpg

Application -- Web Browser/Web Server
Presentation -- HTTP/HTTPS/SSL and language (HTML/JavaScript, etc).
Session -- Browser-Server connection, etc.
Transport -- Port 80/Port 443, packet transfer control, etc.
Network -- IP Address/Internet/Router
Data Link -- Network card driver/binding
Physical -- Media stuffs (Network cable, wireless, etc).

 Yeah, this is why everyone was interested - you're wrong. :-)
Me wrong?  Really!  :-)

 That code will throw an error is headers have already been sent. Headers
 are sent as soon as output begins, so you can either set all of your
 headers prior to any output or use output buffering with ob_start().

 So, use header().
Yea, working on it  Wish can make the 3rd party software come after the
header()..

FletchSOD

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



Re: [PHP] fsockopen to spit out the HTTP's Location...

2004-03-23 Thread Scott Fletcher
 Why not delete that part of the 3rd party code then? Or send your Location
 header before you call it? Curl won't help you here, for the same reasons
 that fsockopen won't work.
Not sure about deleting the part of the 3rd party code though, I had thought
about it alot and I had been itching for it.  Can't say that I would
remember this 2 months from now with the upgrading parting.  Location
header, it wouldn't hurt to move it around in the script.

FletchSOD

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



Re: [PHP] fsockopen to spit out the HTTP's Location...

2004-03-23 Thread Chris Shiflett
--- Scott Fletcher [EMAIL PROTECTED] wrote:
 Application -- Web Browser/Web Server
 Presentation -- HTTP/HTTPS/SSL and language (HTML/JavaScript, etc).
 Session -- Browser-Server connection, etc.
 Transport -- Port 80/Port 443, packet transfer control, etc.
 Network -- IP Address/Internet/Router
 Data Link -- Network card driver/binding
 Physical -- Media stuffs (Network cable, wireless, etc).

In this case, fsockopen() basically handles everything from the Transport
layer down, and whatever you write needs to handle everything from the
Session layer up.

  So, use header().

 Yea, working on it  Wish can make the 3rd party software come after
 the header()..

You don't have to. All you have to do is make sure no output comes before
your 3rd party software. If you can't avoid this, you can put ob_start()
at the very top, and PHP will buffer the output for you, so that headers
aren't sent until the script terminates. Whatever works best for you.

Hope that helps.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] fsockopen to spit out the HTTP's Location...

2004-03-22 Thread Chris Shiflett
--- Scott Fletcher [EMAIL PROTECTED] wrote:
 I haven't found the right wording to spit out the HTTP scripts to
 the web browser through the fsockopen.

I feel certain that I can help you, but unfortunately I can't seem to
understand your question at all. Please understand that I'm not trying to
criticize your question, but there are some things that confuse me.

For example, HTTP is a protocol, and I must assume that you mean HTTP
headers (rather than scripts). More importantly, unless you really know
what you're doing and have a very specific environment, there is no way
you can connect to the user using fsockopen().

 In this case, the Location:  script. I can not use the php
 header() function because of the FPDF strict checking.

Can you explain this? Why can you not use header()? I think your
assumption is wrong.

I can't erally make out the rest of your message, but I think that if you
can explain these statements, the rest might make more sense.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

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



Re: [PHP] fsockopen() errors.

2004-03-08 Thread Miguel J. Jiménez
Is it an error or a warning? If it is a warning you can try use @  
before fsockopen() to avoid echoing warning messages [EMAIL PROTECTED](...)].

--

Miguel J. Jiménez
ISOTROL, S.A. (Área de Internet)
Avda. Innovación nº1, 3ª - 41020 Sevilla (ESPAÑA)
[EMAIL PROTECTED]
TLFNO. 955036800 ext. 111
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] fsockopen() errors.

2004-03-08 Thread Phil Ewington - 43 Plc
Hi Miguel,

I am giving it a test at the moment, thanks.

-- Phil.


 -Original Message-
 From: Miguel J. Jiménez [mailto:[EMAIL PROTECTED]
 Sent: 08 March 2004 12:29
 To: Phil Ewington - 43 Plc
 Cc: PHP
 Subject: Re: [PHP] fsockopen() errors.


 Is it an error or a warning? If it is a warning you can try use @
 before fsockopen() to avoid echoing warning messages [EMAIL PROTECTED](...)].

 --

 Miguel J. Jiménez
 ISOTROL, S.A. (Área de Internet)
 Avda. Innovación nº1, 3ª - 41020 Sevilla (ESPAÑA)
 [EMAIL PROTECTED]
 TLFNO. 955036800 ext. 111

 --
 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



RE: [PHP] fsockopen() errors.

2004-03-08 Thread Phil Ewington - 43 Plc
Hmm, added @ to fsockopen() function, still happens, can anyone shed any
light on this?

TIA

Phil.



 -Original Message-
 From: Phil Ewington - 43 Plc [mailto:[EMAIL PROTECTED]
 Sent: 08 March 2004 12:57
 To: Miguel J. Jiménez
 Cc: PHP
 Subject: RE: [PHP] fsockopen() errors.


 Hi Miguel,

 I am giving it a test at the moment, thanks.

 -- Phil.


  -Original Message-
  From: Miguel J. Jiménez [mailto:[EMAIL PROTECTED]
  Sent: 08 March 2004 12:29
  To: Phil Ewington - 43 Plc
  Cc: PHP
  Subject: Re: [PHP] fsockopen() errors.
 
 
  Is it an error or a warning? If it is a warning you can try use @
  before fsockopen() to avoid echoing warning messages [EMAIL PROTECTED](...)].
 
  --
 
  Miguel J. Jiménez
  ISOTROL, S.A. (Área de Internet)
  Avda. Innovación nº1, 3ª - 41020 Sevilla (ESPAÑA)
  [EMAIL PROTECTED]
  TLFNO. 955036800 ext. 111
 
  --
  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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] fsockopen()

2003-09-30 Thread Jason Wong
On Tuesday 30 September 2003 18:46, Phil Ewington - 43 Plc wrote:

 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.

Have you checked that it is really an invalid domain and not simply been 
hijacked by Versign:

  http://www.techweb.com/tech/network/20030926_network

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
H. L. Mencken's Law:
Those who can -- do.
Those who can't -- teach.

Martin's Extension:
Those who cannot teach -- administrate.
*/

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



RE: [PHP] fsockopen()

2003-09-30 Thread Phil Ewington - 43 Plc
Positive, I am deliberately using invalid domains to test how to catch
errors when users misspell their domain.



-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]
Sent: 30 September 2003 12:01
To: [EMAIL PROTECTED]
Subject: Re: [PHP] fsockopen()


On Tuesday 30 September 2003 18:46, Phil Ewington - 43 Plc wrote:

 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.

Have you checked that it is really an invalid domain and not simply been
hijacked by Versign:

  http://www.techweb.com/tech/network/20030926_network

--
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
H. L. Mencken's Law:
Those who can -- do.
Those who can't -- teach.

Martin's Extension:
Those who cannot teach -- administrate.
*/

--
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



Re: [PHP] fsockopen()

2003-09-30 Thread Jason Wong
On Tuesday 30 September 2003 20:39, Phil Ewington - 43 Plc wrote:
 Positive, I am deliberately using invalid domains to test how to catch
 errors when users misspell their domain.

Did you read that article (or are you aware of what it is about)?

And what invalid domains have you tried?

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Life is the childhood of our immortality.
-- Goethe
*/

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



RE: [PHP] fsockopen()

2003-09-30 Thread Phil Ewington - 43 Plc
Sorry Jason, I did read the article but must have been away with the fairies
for a moment. I was testing domains that are complete rubbish but they were
all .com and .net so yes you were right and I am a complete fool ;o). Now
getting an error message 'No such file or directory' when testing on another
TLD, strange message for 'domain cannot be found', but hey life would be
boring if everyone thought along the same lines :o)


-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]
Sent: 30 September 2003 15:51
To: [EMAIL PROTECTED]
Subject: Re: [PHP] fsockopen()


On Tuesday 30 September 2003 20:39, Phil Ewington - 43 Plc wrote:
 Positive, I am deliberately using invalid domains to test how to catch
 errors when users misspell their domain.

Did you read that article (or are you aware of what it is about)?

And what invalid domains have you tried?

--
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Life is the childhood of our immortality.
-- Goethe
*/

--
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



Re: [PHP] fsockopen server monitor

2003-09-29 Thread Curt Zirzow
* Thus wrote Cameron Metzke ([EMAIL PROTECTED]):
 Hi there,
 I have been trying to make a simple monitor script using fsockopen. here it
 is
 --Start Code-
 
 ?php
 error_reporting(0);
 include 'config.php';
 $domain = $_POST['domain'];

 [... unneeded code ...]

 td width=50%?php
 // Http port connection
  $http = fsockopen($domain, $httpport, $errno, $errstr, 30);
  if (!$http)
  {

  [.. (130 lines) more unneeded  code  ..]

 
 END CODE
 
 all seems to work ok , except that the http and smtp ports always come up ok
 even when the domain doesnt exist. I am thinking mabey it has something to
 do with verisign playing with the .com names lattley?. any ideas and help
 would be appreciated :)

It seems that you've already answered your question.

rant
and playing is a rather nice term; I'd rather say something like
destroying, stealing, monopolizing, betraying, untrusting,
stupidly trying to make the 'internet' more friendly by taking
advantage of certain organizations that weren't on the ball with
the .com names.
/rant

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] fsockopen server monitor

2003-09-29 Thread Cameron Metzke
Sorry about that . Its my first post, :(
Curt Zirzow [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 * Thus wrote Cameron Metzke ([EMAIL PROTECTED]):
  Hi there,
  I have been trying to make a simple monitor script using fsockopen. here
it
  is
  --Start Code-
 
  ?php
  error_reporting(0);
  include 'config.php';
  $domain = $_POST['domain'];
 
  [... unneeded code ...]
 
  td width=50%?php
  // Http port connection
   $http = fsockopen($domain, $httpport, $errno, $errstr, 30);
   if (!$http)
   {
 
   [.. (130 lines) more unneeded  code  ..]
 
 
  END CODE
 
  all seems to work ok , except that the http and smtp ports always come
up ok
  even when the domain doesnt exist. I am thinking mabey it has something
to
  do with verisign playing with the .com names lattley?. any ideas and
help
  would be appreciated :)

 It seems that you've already answered your question.

 rant
 and playing is a rather nice term; I'd rather say something like
 destroying, stealing, monopolizing, betraying, untrusting,
 stupidly trying to make the 'internet' more friendly by taking
 advantage of certain organizations that weren't on the ball with
 the .com names.
 /rant

 Curt
 --
 I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] fsockopen

2003-07-22 Thread Curt Zirzow
* Thus wrote Mike Migurski ([EMAIL PROTECTED]):
  preg_match('/(!DOCTYPE.+\/html)/ms', $http_response, $html)
 
  ...puts it into $html[1]. Adjust to suit your local standards-compliance
  practices. You can also look for everything after the first instance of
  \n\n.
 
 Thats assuming that the person used the doctypehtml for the first
 item. what bout extra space, SSI, etc...
 
 SSI's wouldn't be output on port 80, and anything before the doctype is
 essentially junk anyway. Like I said, suit to taste or just pull from
 after the first \n\n -- no regexp needed in that case.

My bad, i had overlooked that ssi's get expanded before it gets to the
client.

Thanks,

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



RE: [PHP] fsockopen

2003-07-22 Thread Boaz Yahav
If you only need the HTML why don't you look up file()

http://www.weberdev.com/get_example.php3?count=729

Sincerely
 
berber
 
Visit http://www.weberdev.com/ Today!!!
To see where PHP might take you tomorrow.
Share your code : http://addexample.weberdev.com


-Original Message-
From: Doug La Farge [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 22, 2003 12:27 AM
To: [EMAIL PROTECTED]
Subject: [PHP] fsockopen


Is there a way to get fsockopen to suppress the header information it 
returns.  I have no use for the crap, have no idea how to use a regexp 
to get it out of there (nor does anyone on this list it would seem 
either).


I'd like to be able to grab a web page as it is presented to the 
browsers (as seen in view source).

HTTP/1.1 200 OK
Date: Tue, 22 Jul 2003 05:14:41 GMT
Server: Apache/1.3.27 (Unix) mod_jk/1.1.0 mod_ssl/2.8.12 OpenSSL/0.9.6g
Set-Cookie: JSESSIONID=jwjesefa81;Path=/Interface
Connection: close
Content-Type: text/html;charset=ISO-8859-1

The above crap needs to not be returned.

Any ideas?

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



RE: [PHP] fsockopen

2003-07-22 Thread Mike Migurski
Is there a way to get fsockopen to suppress the header information it
returns.  I have no use for the crap, have no idea how to use a regexp to
get it out of there (nor does anyone on this list it would seem either).

preg_match('/(!DOCTYPE.+\/html)/ms', $http_response, $html)

...puts it into $html[1]. Adjust to suit your local standards-compliance
practices. You can also look for everything after the first instance of
\n\n.

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html


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



Re: [PHP] fsockopen

2003-07-22 Thread Curt Zirzow
* Thus wrote Mike Migurski ([EMAIL PROTECTED]):
 Is there a way to get fsockopen to suppress the header information it
 returns.  I have no use for the crap, have no idea how to use a regexp to
 get it out of there (nor does anyone on this list it would seem either).
 
 preg_match('/(!DOCTYPE.+\/html)/ms', $http_response, $html)
 
 ...puts it into $html[1]. Adjust to suit your local standards-compliance
 practices. You can also look for everything after the first instance of
 \n\n.

Thats assuming that the person used the doctypehtml  for the first
item. what bout extra space, SSI, etc...

Yeah I know that a proper html doc should have that doctype as the first
line, but most people dont even know what the doctype is used for if the
even know that one exists.

best to look for the first empty line, that seperates the headers and
content.

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] fsockopen

2003-07-22 Thread Mike Migurski
 preg_match('/(!DOCTYPE.+\/html)/ms', $http_response, $html)

 ...puts it into $html[1]. Adjust to suit your local standards-compliance
 practices. You can also look for everything after the first instance of
 \n\n.

Thats assuming that the person used the doctypehtml for the first
item. what bout extra space, SSI, etc...

SSI's wouldn't be output on port 80, and anything before the doctype is
essentially junk anyway. Like I said, suit to taste or just pull from
after the first \n\n -- no regexp needed in that case.

Personally, I'm using the regexp method, because I'm using the above code
in a context where the server is flakey. I need to repeat the request
immediately if PHP craps out and dies before the '/html' is output. It's
a proxy that allows for the possibility of segfaults and premature exits
and such.

looks like this if you are curious. the usleep give the server increasing
amount of chill-out time as the number of attempts is incremented:
-
do {
usleep(pow(4, $attempt));

if($fp = @fsockopen($GLOBALS['_SERVER']['HTTP_HOST'], 80, $errno, $errstr, 30)) {
fputs($fp, sprintf(GET %s?fresh=fresh HTTP/1.0\nHost: %s\nConnection: 
close\n\n,
   str_replace('proxy.php', 'view.php', 
$GLOBALS['_SERVER']['REQUEST_URI']),
   $GLOBALS['_SERVER']['HTTP_HOST']));

$html = '';
while(!feof($fp)) $html .= fgets($fp, 128);
fclose($fp);

}

} while((++$attempt = $max_tries)  !preg_match('/(!DOCTYPE.+\/html)/ms', $html, 
$matches));
-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html


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



Re: [PHP] fsockopen

2003-07-21 Thread Curt Zirzow
* Thus wrote Doug La Farge ([EMAIL PROTECTED]):
 Is there a way to get fsockopen to suppress the header information it 
 returns.  I have no use for the crap, have no idea how to use a regexp 
 to get it out of there (nor does anyone on this list it would seem 
 either).

I have plenty of use for the so called 'crap'. I know how to use a
regex  to strip it out of there, and your using the *wrong* function.

RTFM...
(no link provided)

 
 
 I'd like to be able to grab a web page as it is presented to the 
 browsers (as seen in view source).

That is not how it is presented to the browser. The browser presents to
you something entirely different.

 
 HTTP/1.1 200 OK
 Date: Tue, 22 Jul 2003 05:14:41 GMT
 Server: Apache/1.3.27 (Unix) mod_jk/1.1.0 mod_ssl/2.8.12 OpenSSL/0.9.6g
 Set-Cookie: JSESSIONID=jwjesefa81;Path=/Interface
 Connection: close
 Content-Type: text/html;charset=ISO-8859-1
 
 The above crap needs to not be returned.

Yes it does.

 
 Any ideas?

Of course.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



RE: [PHP] fsockopen - returning results from port 80, 8080 and 443 requests

2003-07-07 Thread Dave [Hawk-Systems]
any takers on this, before I give up and drop to curl for those types of
requests?

Dave

Creating a quick script where we can poll the services on a particular
server to
verify if they are running or not.  this will be included in a larger scope
application once the details are worked out.

Am having a problem getting results from queries to web server ports though.
Port 80(std), 8080(FP), and 443(SSL) either timeout without returning any
results, or error with some of the other attempts at illiciting a response that
we have tried (like specifying ssl:// prior to the hostname).

Code and two smaple outputs below. Thoughts?

Dave

!-- begin socket.php --
?PHP
# get form submitted host
$host=$_POST['host'];
$portstring=array(Testing SSH:br\n,Testing TELNET:br\n,Testing
FTP:br\n,Testing HTTP:br\n,Testing HTTPS:br\n,Testing
SMTP:br\n,Testing POP3:br\n,Testing IMAP:br\n);
$portput=array(,,,GET / HTTP/1.1\r\nHost: $host\r\n\r\n,GET /
HTTP/1.1\r\nHost: $host\r\n\r\n,,,);
$portprepend=array(,,,tcp://,ssl://,,,);
$port=array(22,23,21,80,443,25,110,143);
for($i=0;$icount($port);$i++){
$result=date(H:i:s).-;
$fp = fsockopen($portprepend[$i].$host, $port[$i], $errno, $errstr,5);
if (!$fp){
$result=$portstring[$i].nbsp;nbsp;nbsp;Error($errno): $errstrbr\n;
}else{
# see if we have to nudge for a response
if(strlen($portput[$i]0)){
fputs ($fp, $portput[$i]);
}
#   get the response
$result.=$portstring[$i].nbsp;nbsp;nbsp;;
$result.= fgets($fp,1024);
fclose ($fp);
$result.=br\n;
$result=trim($result);
}
echo $result;
flush;
}
?
!--  end  socket.php --

!-- begin sample output with tcp:// for 80 and ssl:// for 443 --
12:20:13-Testing SSH:
   SSH-1.99-OpenSSH_3.5p1 FreeBSD-20030201
12:20:13-Testing TELNET:
   Error(61): Connection refused
12:20:13-Testing FTP:
   220 isp1.nexusinternetsolutions.net FTP server (Version 6.00LS) ready.
12:20:13-Testing HTTP:
   Error(0):
12:20:13-Testing HTTPS:
   Error(0):
12:20:13-Testing SMTP:
   220 isp1.nexusinternetsolutions.net ESMTP
12:20:13-Testing POP3:
   Error(61): Connection refused
12:20:13-Testing IMAP:
   Error(61): Connection refused
!--  end  sample output with tcp:// for 80 and ssl:// for 443 --

!-- begin sample output with  for 80 and  for 443 --
12:21:44-Testing SSH:
   SSH-1.99-OpenSSH_3.5p1 FreeBSD-20030201
12:21:44-Testing TELNET:
   Error(61): Connection refused
12:21:44-Testing FTP:
   220 isp1.nexusinternetsolutions.net FTP server (Version 6.00LS) ready.
12:21:44-Testing HTTP:

12:26:46-Testing HTTPS:

12:31:47-Testing SMTP:
   220 isp1.nexusinternetsolutions.net ESMTP
12:31:47-Testing POP3:
   Error(61): Connection refused
12:31:47-Testing IMAP:
   Error(61): Connection refused
!--  end  sample output with  for 80 and  for 443 --



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



Re: [PHP] fsockopen and SSL

2003-06-07 Thread Philip Olson
[snip]
 but I get following error:
 
 Warning: fsockopen() [function.fsockopen]: no SSL support in this build
 in
 /usr/home/trivisions/html/sextoymerchant.com/payment/checkout_confirm.ph
 p on line 64
 
 So does this mean that my PHP installation does not support SSL, and
 that I have to recompile PHP again?
 
 I looked at the PHP installation configure options but did not see
 anything regarding SSL, so how would I install this?

From the manual:

  php.net/fsockopen

  As of PHP 4.3.0, if you have compiled in OpenSSL support, you
   may prefix the hostname with either 'ssl://' or 'tls://' to 
   use an SSL or TLS client connection over TCP/IP to connect 
   to the remote host.

  php.net/openssl

  To use PHP's OpenSSL support you must also compile PHP
--with-openssl[=DIR].

Regards,
Philip




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



Re: [PHP] fsockopen() with SSL?

2003-02-28 Thread Ernest E Vogelsinger
At 14:11 28.02.2003, Michael Temeschinko said:
[snip]
Hello,
is it possible to fetch a Website via SSL?
[snip] 

Sure - have a look at cUrl...


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



Re: [PHP] fsockopen() to remote URL: what if remote URL times out?

2003-01-10 Thread Maxim Maletsky

Phil Powell [EMAIL PROTECTED] wrote... :

 I have a question about the usage of fsockopen() to open and scrape the contents 
of a remote URL: if the contents take a very long time to load on the remote URL 
either due to server or coding issues, is there a way for the socket on the PHP end 
to time out, that is, quit trying to scrape contents from the remote site and post 
a default message instead?


Yes, it is the last parameter of the fsockopen() function. Normally, it
will be set to something like 30 seconds, you might adjust it to
whatever you like. After that time you will get error 110 which means
Connection timed out. Additionally, if you set anything over 30
seconds, you might also consider altering the execution time limit for
the php script itself.



--
Maxim Maletsky
[EMAIL PROTECTED]



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




Re: [PHP] fsockopen timeout not working

2002-10-07 Thread Rasmus Lerdorf

You should read up on socket_select

On Tue, 8 Oct 2002, Scott Dowd wrote:

 I have a PHP application that goes out an checks all our servers via
 SNMP when requested. Trouble is, if the server is not available, the
 fsockopen never times out and therefore never moves onto the next
 server. I am running 4.2.3 on IIS (NT4). I read there was a bug with
 previous versions, but I have just upgraded and still seems to be a
 problem .. Script times out.

 $fp = fsockopen ($servername, 524, $errno, $errstr, 30);

 if (!$fp) {
  
 }

 else {
  
 }



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




RE: [PHP] fsockopen question

2002-07-04 Thread Martin Towell

you can do more than one fsockopen(), but since php isn't multi-threaded -
you'll still only be able to download one file at a time.

-Original Message-
From: Jose Arce [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 04, 2002 4:39 PM
To: [EMAIL PROTECTED]
Subject: [PHP] fsockopen question


Hi, i'm making a script to transfer all the zips from my old server to my 
new one, i mean, server to server. That's the easy part. The cuestion is:

Can i open more than just one instance for fsockopen to retrieve more files 
in the same script, at the same time? i mean, not one by one (that will be 
slow), but 4 or 5 at the same time...
some people think it's possible, some people don't...thx :D

_
MSN. Más Útil cada Día. http://www.msn.es/intmap/


-- 
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




RE: [PHP] fsockopen question

2002-07-04 Thread Jose Arce

So...i can do more than one fsockopen()...but is not multi-thread? i don't 
understand...i mean...if i can open more than one fsockopen...it is 
multithread, or in wich cases php open more than one fsockopen?
thx :D


From: Martin Towell [EMAIL PROTECTED]
To: 'Jose Arce' [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: RE: [PHP] fsockopen question
Date: Thu, 4 Jul 2002 16:39:36 +1000

you can do more than one fsockopen(), but since php isn't multi-threaded -
you'll still only be able to download one file at a time.

-Original Message-
From: Jose Arce [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 04, 2002 4:39 PM
To: [EMAIL PROTECTED]
Subject: [PHP] fsockopen question


Hi, i'm making a script to transfer all the zips from my old server to my
new one, i mean, server to server. That's the easy part. The cuestion is:

Can i open more than just one instance for fsockopen to retrieve more files
in the same script, at the same time? i mean, not one by one (that will be
slow), but 4 or 5 at the same time...
some people think it's possible, some people don't...thx :D

_
MSN. Más Útil cada Día. http://www.msn.es/intmap/


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




_
MSN Fotos: la forma más fácil de compartir e imprimir fotos. 
http://photos.msn.es/support/worldwide.aspx


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




RE: [PHP] fsockopen question

2002-07-04 Thread Martin Towell

I mean, you can do

?
// been a while, so syntax is prob. wrong :(
$sock1 = fsockopen($host, 80);
$sock2 = fsockopen($host, 80);

fputs($sock1, GET /file1.html HTTP/1.0\r\n\r\n);
fputs($sock2, GET /file2.html HTTP/1.0\r\n\r\n);

$content1 = fgets($sock1, 102400);
$content2 = fgets($sock1, 102400);

$fclose($sock1);
$fclose($sock2);
?

each of the fgets()'s will be executed sequentially. But there's two sockets
open...


-Original Message-
From: Jose Arce [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 04, 2002 4:48 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] fsockopen question


So...i can do more than one fsockopen()...but is not multi-thread? i don't 
understand...i mean...if i can open more than one fsockopen...it is 
multithread, or in wich cases php open more than one fsockopen?
thx :D


From: Martin Towell [EMAIL PROTECTED]
To: 'Jose Arce' [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: RE: [PHP] fsockopen question
Date: Thu, 4 Jul 2002 16:39:36 +1000

you can do more than one fsockopen(), but since php isn't multi-threaded -
you'll still only be able to download one file at a time.

-Original Message-
From: Jose Arce [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 04, 2002 4:39 PM
To: [EMAIL PROTECTED]
Subject: [PHP] fsockopen question


Hi, i'm making a script to transfer all the zips from my old server to my
new one, i mean, server to server. That's the easy part. The cuestion is:

Can i open more than just one instance for fsockopen to retrieve more files
in the same script, at the same time? i mean, not one by one (that will be
slow), but 4 or 5 at the same time...
some people think it's possible, some people don't...thx :D

_
MSN. Más Útil cada Día. http://www.msn.es/intmap/


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




_
MSN Fotos: la forma más fácil de compartir e imprimir fotos. 
http://photos.msn.es/support/worldwide.aspx


-- 
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




Re: [PHP] fsockopen question

2002-07-04 Thread Tracker 1

you can do more than one fsockopen, which means you will have
multiple sockets open, however, these are part of the same thread
in the same process.. in other words, you can't do two things at
once by default.. with php-gtk, you can maybe have multiple user
events.. and not sure if you can emulate it..

--
===
Michael J. Ryan  -  tracker1[*at*]theroughnecks.com
Roughneck BBS: http://www.theroughnecks.net  telnet://theroughnecks.net
===
Y!: aztracker1 - aim: azTracker1 - icq: 4935386 - msn: see email
One program for aim/icq/yahoo/msn/irc  -  http://www.trillian.cc/


Jose Arce [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 So...i can do more than one fsockopen()...but is not multi-thread? i don't
 understand...i mean...if i can open more than one fsockopen...it is
 multithread, or in wich cases php open more than one fsockopen?
 thx :D


 From: Martin Towell [EMAIL PROTECTED]
 To: 'Jose Arce' [EMAIL PROTECTED], [EMAIL PROTECTED]
 Subject: RE: [PHP] fsockopen question
 Date: Thu, 4 Jul 2002 16:39:36 +1000
 
 you can do more than one fsockopen(), but since php isn't multi-threaded -
 you'll still only be able to download one file at a time.
 
 -Original Message-
 From: Jose Arce [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, July 04, 2002 4:39 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] fsockopen question
 
 
 Hi, i'm making a script to transfer all the zips from my old server to my
 new one, i mean, server to server. That's the easy part. The cuestion is:
 
 Can i open more than just one instance for fsockopen to retrieve more files
 in the same script, at the same time? i mean, not one by one (that will be
 slow), but 4 or 5 at the same time...
 some people think it's possible, some people don't...thx :D
 
 _
 MSN. Más Útil cada Día. http://www.msn.es/intmap/
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




 _
 MSN Fotos: la forma más fácil de compartir e imprimir fotos.
 http://photos.msn.es/support/worldwide.aspx




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




RE: [PHP] fsockopen question

2002-07-04 Thread Jose Arce

now it's clear  thx :D
is not the same thing as:
while ($i  100) {
$sock = fsockopen($host, 80);
fputs($sock, GET /file.$i.html HTTP/1.0\r\n\r\n);
}
isn't?

From: Martin Towell [EMAIL PROTECTED]
To: 'Jose Arce' [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: RE: [PHP] fsockopen question
Date: Thu, 4 Jul 2002 16:49:59 +1000

I mean, you can do

?
// been a while, so syntax is prob. wrong :(
$sock1 = fsockopen($host, 80);
$sock2 = fsockopen($host, 80);

fputs($sock1, GET /file1.html HTTP/1.0\r\n\r\n);
fputs($sock2, GET /file2.html HTTP/1.0\r\n\r\n);

$content1 = fgets($sock1, 102400);
$content2 = fgets($sock1, 102400);

$fclose($sock1);
$fclose($sock2);
?

each of the fgets()'s will be executed sequentially. But there's two 
sockets
open...


-Original Message-
From: Jose Arce [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 04, 2002 4:48 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] fsockopen question


So...i can do more than one fsockopen()...but is not multi-thread? i don't
understand...i mean...if i can open more than one fsockopen...it is
multithread, or in wich cases php open more than one fsockopen?
thx :D


 From: Martin Towell [EMAIL PROTECTED]
 To: 'Jose Arce' [EMAIL PROTECTED], [EMAIL PROTECTED]
 Subject: RE: [PHP] fsockopen question
 Date: Thu, 4 Jul 2002 16:39:36 +1000
 
 you can do more than one fsockopen(), but since php isn't multi-threaded 
-
 you'll still only be able to download one file at a time.
 
 -Original Message-
 From: Jose Arce [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, July 04, 2002 4:39 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] fsockopen question
 
 
 Hi, i'm making a script to transfer all the zips from my old server to my
 new one, i mean, server to server. That's the easy part. The cuestion is:
 
 Can i open more than just one instance for fsockopen to retrieve more 
files
 in the same script, at the same time? i mean, not one by one (that will 
be
 slow), but 4 or 5 at the same time...
 some people think it's possible, some people don't...thx :D
 
 _
 MSN. Más Útil cada Día. http://www.msn.es/intmap/
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




_
MSN Fotos: la forma más fácil de compartir e imprimir fotos.
http://photos.msn.es/support/worldwide.aspx


--
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




_
Únase al mayor servicio mundial de correo electrónico: 
http://www.hotmail.com/es


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




RE: [PHP] fsockopen question

2002-07-04 Thread Martin Towell

That's still running sequentially

-Original Message-
From: Jose Arce [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 04, 2002 5:01 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] fsockopen question


now it's clear  thx :D
is not the same thing as:
while ($i  100) {
$sock = fsockopen($host, 80);
fputs($sock, GET /file.$i.html HTTP/1.0\r\n\r\n);
}
isn't?

From: Martin Towell [EMAIL PROTECTED]
To: 'Jose Arce' [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: RE: [PHP] fsockopen question
Date: Thu, 4 Jul 2002 16:49:59 +1000

I mean, you can do

?
// been a while, so syntax is prob. wrong :(
$sock1 = fsockopen($host, 80);
$sock2 = fsockopen($host, 80);

fputs($sock1, GET /file1.html HTTP/1.0\r\n\r\n);
fputs($sock2, GET /file2.html HTTP/1.0\r\n\r\n);

$content1 = fgets($sock1, 102400);
$content2 = fgets($sock1, 102400);

$fclose($sock1);
$fclose($sock2);
?

each of the fgets()'s will be executed sequentially. But there's two 
sockets
open...


-Original Message-
From: Jose Arce [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 04, 2002 4:48 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] fsockopen question


So...i can do more than one fsockopen()...but is not multi-thread? i don't
understand...i mean...if i can open more than one fsockopen...it is
multithread, or in wich cases php open more than one fsockopen?
thx :D


 From: Martin Towell [EMAIL PROTECTED]
 To: 'Jose Arce' [EMAIL PROTECTED], [EMAIL PROTECTED]
 Subject: RE: [PHP] fsockopen question
 Date: Thu, 4 Jul 2002 16:39:36 +1000
 
 you can do more than one fsockopen(), but since php isn't multi-threaded 
-
 you'll still only be able to download one file at a time.
 
 -Original Message-
 From: Jose Arce [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, July 04, 2002 4:39 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] fsockopen question
 
 
 Hi, i'm making a script to transfer all the zips from my old server to my
 new one, i mean, server to server. That's the easy part. The cuestion is:
 
 Can i open more than just one instance for fsockopen to retrieve more 
files
 in the same script, at the same time? i mean, not one by one (that will 
be
 slow), but 4 or 5 at the same time...
 some people think it's possible, some people don't...thx :D
 
 _
 MSN. Más Útil cada Día. http://www.msn.es/intmap/
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




_
MSN Fotos: la forma más fácil de compartir e imprimir fotos.
http://photos.msn.es/support/worldwide.aspx


--
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




_
Únase al mayor servicio mundial de correo electrónico: 
http://www.hotmail.com/es

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




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

2002-06-27 Thread Chris Shiflett

Alex Elderson wrote:

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.

This is because persistent TCP connections are the default behavior of 
HTTP/1.1. In HTTP/1.0, the client had to specifically request a 
persistent connection via the use of a Connection: Keep-Alive header 
in the HTTP request. Now (HTTP/1.1) it is quite the opposite; the client 
must specifically request for the server to close the connection with a 
Connection: Close header in the HTTP request.

What is happening for you is this:
1) you use PHP socket functions to manually generate an HTTP request to 
a remote Web server
2) The Web server responds to your request and likely includes a 
Connection: Close header in the response. It does not, however, close 
the connection itself. It is simply letting you know that it is finished.
3) You do not parse the response or close the connection. You just sit 
there, and thus, nothing happens until a timeout condition is reached.

You are basically implementing a primitive Web client, which is a very 
rewarding experience in terms of the education you provide yourself. It 
requires you, however, to deal with many details of socket programming. 
By leaving the socket open, you are able to send additional HTTP 
requests without all of the overhead of creating/destroying a socket for 
each transaction. This is extremely helpful, of course, for Web pages 
that include several images, so the GET requests for those images can be 
sent on the same connection. Additionally, you can now pipeline your 
requests; you do not have to wait for a response before issuing your 
next request.

If you simply want to make a single request, receive the response, and 
have the connection be terminated, go ahead and include the Connection: 
Close header in your HTTP request, and this will request that the Web 
server close the connection for you. Otherwise, you'll need to do it for 
yourself. To close the connection yourself, you need to know when the 
server is finished sending, correct? You do this in two steps:

1) The header portion of the response is terminated by \r\n\r\n (though 
you should be prepared to accept just \n\n).
2) You read exactly how many bytes were specified in the 
Content-Length header and close the connection when you receive that.

That's a basic introduction into the semantics of what you're getting 
into. If you still need more information, feel free to ask more 
questions; I enjoy explaining HTTP. Copy me on any responses if you want 
to ensure that I'll not miss your message.

Cheers.

Chris


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




Re: [PHP] fsockopen

2002-06-24 Thread Evan Nemerson

Try

fputs ($fp,GET .$url[path]. HTTP/1.0\r\nHost:  . $url[host] . \r\n\r\n);

Your old request looked like GET / HTTP/1.0\r\nHost:value_of_host/\r\n\r\n, 
hence the 400.


On Monday 24 June 2002 17:40 pm, Gerard Samuel wrote:
 Im trying to figure out fsockopen to grab an rdf file.
 Here is the code -
 -
 ?php

 $str = 'http://slashcode.com/slashcode.rss';
 $url = parse_url($str);

 $path = ($url['path']) ? $url['path'] : '/';
 $port = ($url['port']) ? $url['port'] : '80';

 if ($fp = fsockopen($url['host'], $port, $errno, $errstr, 5))
 {
 fputs ($fp,GET / HTTP/1.0\r\nHost: . $url[host] . $url[path] .
 \r\n\r\n);
 while (!feof($fp))
 {
 echo fgets($fp, 1024);
 }

 fclose ($fp);
 }
 else
 {
 echo Problem: $errno;
 }

 ?
 -

 Its coming back with a HTTP/1.1 400 Bad Request

 Any help would be greatly appreciated.
 Thanks

-- 
Only one who devotes himself to a cause with his whole strength and soul can 
be a true master. For this reason mastery demands all of a person.

Albert Einstein


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




Re: [PHP] fsockopen

2002-06-24 Thread Gerard Samuel

Worked perfectly.
Thanks.

Evan Nemerson wrote:

Try

fputs ($fp,GET .$url[path]. HTTP/1.0\r\nHost:  . $url[host] . \r\n\r\n);

Your old request looked like GET / HTTP/1.0\r\nHost:value_of_host/\r\n\r\n, 
hence the 400.


On Monday 24 June 2002 17:40 pm, Gerard Samuel wrote:
  

Im trying to figure out fsockopen to grab an rdf file.
Here is the code -
-
?php

$str = 'http://slashcode.com/slashcode.rss';
$url = parse_url($str);

$path = ($url['path']) ? $url['path'] : '/';
$port = ($url['port']) ? $url['port'] : '80';

if ($fp = fsockopen($url['host'], $port, $errno, $errstr, 5))
{
fputs ($fp,GET / HTTP/1.0\r\nHost: . $url[host] . $url[path] .
\r\n\r\n);
while (!feof($fp))
{
echo fgets($fp, 1024);
}

fclose ($fp);
}
else
{
echo Problem: $errno;
}

?
-

Its coming back with a HTTP/1.1 400 Bad Request

Any help would be greatly appreciated.
Thanks



  


-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/




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




Re: [PHP] fsockopen

2002-05-16 Thread Miguel Cruz

On Thu, 16 May 2002, Scott St. John wrote:
 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.

When I test it fails is not a useful problem report.

Show the relevant parts of the code you're running and tell us what, 
specifically is happening (i.e., if an error message is displayed, paste 
that into your problem report; if a variable seems to be getting an 
unexpected value, change your code to print that value out, and then show 
us both the code and the value that it actually printed out).

Otherwise it's just sort of a guessing game.

miguel


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




RE: [PHP] fsockopen

2002-04-26 Thread Vail, Warren

I haven't tried this, but why don't you just use fopen with a URL,
especially if you don't what to have to deal with the http header.  

I would think that if you do the fsockopen to port 80, you will need to use
the handshake protocol required by that server which involves the get/put
http headers.  fopen should handle all that for you.

http://www.php.net/manual/en/function.fopen.php


Warren Vail
Tools, Metrics  Quality Processes
(415) 667-7814
Pager (877) 774-9891
215 Fremont 02-658


-Original Message-
From: wm [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 26, 2002 10:50 AM
To: [EMAIL PROTECTED]
Subject: [PHP] fsockopen


this might be a stupid question, but what the hell...

can a web page be called and diplayed using the fsockopen and
fputs/fgets functions?

so instead of just using a normal href call i use a script and fsockopen
(not header(Location: )  ) etc.?

thanks.




-- 
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




RE: [PHP] fsockopen

2002-03-26 Thread Alastair Battrick

Is $tempPort set ?

Alastair Battrick
Senior Developer
Lightwood Consultancy Ltd
http://www.lightwood.net


 -Original Message-
 From: Christoph Starkmann [mailto:[EMAIL PROTECTED]]
 Sent: 26 March 2002 12:40
 To: '[EMAIL PROTECTED]'
 Subject: [PHP] fsockopen


 Hi!

 I'm trying to check the validity of given hyperlinks...
 I thought this code should work (Apache 1.3.9, Win98)

 $tempUrl = ereg_replace(http://;, , $url);

 $fp = fsockopen ($tempUrl, $tempPort, $errno, $errstr, 30);

 if (!$fp)
 {
 echo brerror opening $url: \$errstr=$errstr, \$errno=$errnobr\n;
 }
 else
 {
 fputs ($fp, GET / HTTP/1.0\r\n\r\n);
   echo brs . fgets($fp,1024);
 fclose($fp);
 }

 For each and every url,

 $fp = false;
 $errstr = ;
 $errno = 0;

 Where is my mistake? I guess I'm simply getting sth wrong...

 Any hint would be great.

 Cheers,
 Kiko

 -
 It's not a bug, it's a feature.
 christoph starkmann
 mailto:[EMAIL PROTECTED]
 http://www.fh-augsburg.de/~kiko
 ICQ: 100601600
 -

 --
 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




RE: [PHP] fsockopen

2002-03-26 Thread Christoph Starkmann

Hi!

 Is $tempPort set ?

Yes... 80 as default...

  $tempUrl = ereg_replace(http://;, , $url);
 
  $fp = fsockopen ($tempUrl, $tempPort, $errno, $errstr, 30);
 
  if (!$fp)
  {
  echo brerror opening $url: \$errstr=$errstr, 
 \$errno=$errnobr\n;
  }
  else
  {
  fputs ($fp, GET / HTTP/1.0\r\n\r\n);
  echo brs . fgets($fp,1024);
  fclose($fp);
  }

Cheers...
Kiko

-
It's not a bug, it's a feature.
christoph starkmann
mailto:[EMAIL PROTECTED]
http://www.fh-augsburg.de/~kiko
ICQ: 100601600
-

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




RE: [PHP] fsockopen

2002-03-26 Thread Alastair Battrick

There are a few things that it could be.

Change the ereg_replace to str_replace

Try adding Host: $server_name on the line after the GET:

fputs ($fp, GET / HTTP/1.0\r\nHost: $server_name\r\n\r\n);

iirc, if the server uses virtual hosts, the GET won't work properly without
it.

If that's not it, try adding this instead of your single echo line:

while (!feof ($fp)) {
  $line = fgets($fp, 4096);
  echo $line;
}

As that will return and echo all the page, not just the header.

Alastair

 -Original Message-
 From: Christoph Starkmann [mailto:[EMAIL PROTECTED]]
 Sent: 26 March 2002 12:48
 To: '[EMAIL PROTECTED]'; Christoph Starkmann; [EMAIL PROTECTED]
 Subject: RE: [PHP] fsockopen


 Hi!

  Is $tempPort set ?

 Yes... 80 as default...

   $tempUrl = ereg_replace(http://;, , $url);
  
   $fp = fsockopen ($tempUrl, $tempPort, $errno, $errstr, 30);
  
   if (!$fp)
   {
   echo brerror opening $url: \$errstr=$errstr,
  \$errno=$errnobr\n;
   }
   else
   {
   fputs ($fp, GET / HTTP/1.0\r\n\r\n);
 echo brs . fgets($fp,1024);
   fclose($fp);
   }

 Cheers...
 Kiko

 -
 It's not a bug, it's a feature.
 christoph starkmann
 mailto:[EMAIL PROTECTED]
 http://www.fh-augsburg.de/~kiko
 ICQ: 100601600
 -


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




RE: [PHP] fsockopen

2002-03-26 Thread Christoph Starkmann

Oohh so sorry... Now it works.
I simply forgot to crop the tailing /
from the URL. Call me stupid for now...

Thanx alot ;)

Cheers,

Kiko

-
Fool me once. Shame on you. Fool me twice. Shame on me.
christoph starkmann
mailto:[EMAIL PROTECTED]
http://www.fh-augsburg.de/~kiko
ICQ: 100601600
-

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




Re: [PHP] fsockopen and HTTP Authorization

2002-02-28 Thread Mika Tuupola

On Thu, 28 Feb 2002, Bas Jobsen wrote:

 I try to do a HTTP Authorization with a fsockopen, but it doesn't seem to 
 work Who can help?
 $user and $passwd are set well, my code:

I think you can spy from PEAR HTTP_Request class how it
can be done:

http://choraphpnet/cvsphp/pear/HTTP_Request

-- 
Mika Tuupola  http://wwwappelsiininet/~tuupola/


-- 
PHP General Mailing List (http://wwwphpnet/)
To unsubscribe, visit: http://wwwphpnet/unsubphp




Re: [PHP] fsockopen and HTTP Authorization

2002-02-27 Thread Bogdan Stancescu

You should have only one \r\n pair after the HTTP request AFAIK - only 
need two when the header ends.

Bogdan

Bas Jobsen wrote:

Hello,

I try to do a HTTP Authorization with a fsockopen, but it doesn't seem to 
work. Who can help?
$user and $passwd are set well, my code:
--
$auth=base64_encode($user.:.$passwd);
$header=GET /pa2/ HTTP/1.0\r\n\r\n;
$header.=Accept: text/html\r\n;
$header.=Authorization: Basic $auth\r\n\r\n;

$fp = fsockopen (localhost, 80, $errno, $errstr, 30);
if (!$fp) echo $errstr ($errno)br\n;
else
{
fputs ($fp,  $header);
while (!feof($fp)) echo fgets ($fp,128);
}
fclose ($fp);
--

Thanks,

Bas





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




Re: [PHP] fsockopen questions

2002-01-24 Thread Mike Frazer

Although they are experimental, I find the socket() and connect() functions
in PHP4 to be much easier to use and manage.  May want to try them, perhaps?
They seem to be a little less tempramental.

Mike Frazer



Bhavin Modi [EMAIL PROTECTED] wrote in message
news:01d901c1a419$deea9de0$0664a8c0@bhavinm...
 You can use CURL extension with PHP to use SSL, provided PHP is compiled
 with CURL library functions. http://www.php.net/manual/en/ref.curl.php

 You can get more help from
 http://www.phpbuilder.com/columns/matt2305.php3

 Regards,
 Bhavin


 - Original Message -
 From: Daniel Reichenbach [EMAIL PROTECTED]
 To: Php-General [EMAIL PROTECTED]
 Sent: Wednesday, January 23, 2002 7:14 PM
 Subject: [PHP] fsockopen questions


  Hy,
 
  for a project I need to connect to a SSL server with PHP. Additionaly I
  have to authenticate myself with username/password with standard auth.
  Is this possible with PHP's fsockopen function? I couldn't find any
  hint on this in the manual.
 
  Greetings,
  Daniel
 
 
  --
  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 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]




Re: [PHP] fsockopen nntp stalls

2001-12-26 Thread Rasmus Lerdorf

Why not just use the imap extension which supports the NNTP protocol 
natively?

On Wed, 26 Dec 2001, Fred wrote:

 I am attempting to use fsockopen to connect to a news server.  I am able to
 successfully connect and authenticate.  In fact, I can issue many commands
 without a hitch.
 
 I do, however, have a problem with commands which require multiline results.
 For instance, issuing the list command and echoing the results to the
 browser invariably results in the browser stalling.  There is no timeout
 error from php, but after an arbitrary number of lines the browser stalls
 and does not receive the rest of the stream.
 
 I first thought this was some type of timeout error, but the odd thing is
 that the amount of data successfully recieves varies depending on the nntp
 server.
 
 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.
 
 If anyone has had any experience with this problem, please let me know what
 you did to resolve it.
 
 Fred
 
 
 
 


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




Re: [PHP] fsockopen nntp stalls

2001-12-26 Thread Fred

Good suggestion, in fact I just recompiled to include the IMAP extensions
for just that purpose.  Unfortunately, I was unable to get a decent
understanding of how to use the IMAP extensions with NNTP, and since I have
implemented connection level NNTP sessions in a number of languages I
thought it may be easier.

If you are aware of a good example or tutorial for implementing NNTP with
IMAP I would appreciate a link.

P.S. Thanks for this wonderful tool.

Fred

Rasmus Lerdorf [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Why not just use the imap extension which supports the NNTP protocol
 natively?

 On Wed, 26 Dec 2001, Fred wrote:

  I am attempting to use fsockopen to connect to a news server.  I am able
to
  successfully connect and authenticate.  In fact, I can issue many
commands
  without a hitch.
 
  I do, however, have a problem with commands which require multiline
results.
  For instance, issuing the list command and echoing the results to the
  browser invariably results in the browser stalling.  There is no timeout
  error from php, but after an arbitrary number of lines the browser
stalls
  and does not receive the rest of the stream.
 
  I first thought this was some type of timeout error, but the odd thing
is
  that the amount of data successfully recieves varies depending on the
nntp
  server.
 
  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.
 
  If anyone has had any experience with this problem, please let me know
what
  you did to resolve it.
 
  Fred
 
 
 
 




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




RE: [PHP] fsockopen - whats the syntax of POST?

2001-11-15 Thread Daniel Kushner

Hi Stefan,

Maybe this HTTPPost class will help you.
http://phpclasses.upperdesign.com/browse.html/package/375

--Daniel

 -Original Message-
 From: Stefan [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, November 15, 2001 8:53 AM
 To: PHP
 Subject: [PHP] fsockopen - whats the syntax of POST?


 First: can I do a POST-request with fsockopen?
 If yes, then: whats the syntax for POST-requests?

 I was happy if someone could point me to a good documentation or so

 Thanks in advance
 Stefan Rusterholz, [EMAIL PROTECTED]
 --
 interaktion gmbh
 Stefan Rusterholz
 Zürichbergstrasse 17
 8032 Zürich
 --
 T. +41 1 253 19 55
 F. +41 1 253 19 56
 W3 www.interaktion.ch
 --



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




Re: [PHP] fsockopen and https

2001-10-27 Thread John

From: Brad Hubbard [EMAIL PROTECTED]

  I am using fsockopen to post data to a dll on a SSL server.  I setup the
  socket data and successfully posted the data to port 80 but as soon as I
  switch to port 443 I received no errors or text.

 Does this help? I use this on web servers to test whether a transaction
 server is available or not. Only works on *nix of course (sorry Bill :-)

 ?php

 $ph = popen( /usr/bin/openssl s_client -connect
secure.geicp.com:443 -quiet
 2/dev/null EOM\nGET / HTTP/1.0\n\nEOM\n, r );
 $response = fgets( $ph, 1024 );

 if( stristr( $response, 200 OK ) )
 {
 header( Location: https://a.secure.server.com; );
 exit;
 }

 ?

Excellent!  This is exactly what I needed.  I now have a class interfacing
with my gateway and do not need cURL!

Thanks a bunch!

-John-



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




Re: [PHP] fsockopen and https

2001-10-26 Thread Frewuill Rodriguez

As far as i know PHP can't handle SSL yet.. at least that was the situation
a few versions ago. =(

- Original Message -
From: Brad Hubbard [EMAIL PROTECTED]
To: John [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, October 26, 2001 5:54 AM
Subject: Re: [PHP] fsockopen and https


 On Fri, 26 Oct 2001 17:18, John wrote:
  Hello All,
 
  I am new to this list and am sure most of you are tired of this subject
  appearing.  Please forgive me as I am becoming tired of searching
archives
  and the internet and I am hoping someone here can help me.
 
  I am using fsockopen to post data to a dll on a SSL server.  I setup the
  socket data and successfully posted the data to port 80 but as soon as I
  switch to port 443 I received no errors or text.

 Does this help? I use this on web servers to test whether a transaction
 server is available or not. Only works on *nix of course (sorry Bill :-)

 ?php

 $ph = popen( /usr/bin/openssl s_client -connect
secure.geicp.com:443 -quiet
 2/dev/null EOM\nGET / HTTP/1.0\n\nEOM\n, r );
 $response = fgets( $ph, 1024 );

 if( stristr( $response, 200 OK ) )
 {
 header( Location: https://a.secure.server.com; );
 exit;
 }

 ?

 Cheers,
 BAD

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




RE: [PHP] fsockopen question

2001-04-26 Thread Matthew Luchak

I use:

$fp = fsockopen(www.somewhere.com,80); 
fputs($fp, GET http://www.somewhere.com/somedir/somepage.html
HTTP/1.0\r\n\r\n);

to parse.  Should be easily modified

 
Matthew Luchak 
Webmaster
Kaydara Inc. 
[EMAIL PROTECTED]


-Original Message-
From: Michael Conley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 26, 2001 12:37 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] fsockopen question



How do I send the XML string to the above URL?  When I use fsockopen, it
doesn't like anything other than an IP address or a host name (ie
www.myprovider.com).  I don't even really see where to force this to go
over
HTTPS.  I set the port to 443, but need to be sure that the data going
across uses SSL.

How do I send this XML string over HTTPS to
https://www.myprovider.com/XMLSubmit/processtrans.asp?


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




RE: [PHP] fsockopen question

2001-04-26 Thread Matthew Luchak


$fp = fsockopen(www.somewhere.com,4096); 

here you have to check the syntax for POST and HTTPS but I THINK
(hoo-boy am I ever risking ridicule) it should look something like this:

fputs($fp, POST https://www.somewhere.com/dir/app  HTTPS/1.0\r\n\r\n,
$xmlstring); 


then try the response..

 
Matthew Luchak 
Webmaster
Kaydara Inc. 
[EMAIL PROTECTED]


-Original Message-
From: Michael Conley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 26, 2001 1:00 PM
To: Matthew Luchak; [EMAIL PROTECTED]
Subject: RE: [PHP] fsockopen question


It looks like that is working, but I'm not getting a response.  I
created the XML string and set it as $xmlstring.  Then, after the fputs
that you provided below (except with the URL I'm sending to) I have:
fputs($fp, $xmlstring);

Then, to receive the response I enter:
$RetValue=fgets($w_socket, );
echo $RetValue;

I am not getting any response, so I have no idea if my XML string is
accepted, rejected or what.  Is this the right way for me to get the
response?  After I send the XML string, they will send me back some info
that will let me know if the transaction is accepted.

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




RE: [PHP] fsockopen question

2001-04-26 Thread Michael Conley

It looks like that is working, but I'm not getting a response.  I created
the XML string and set it as $xmlstring.  Then, after the fputs that you
provided below (except with the URL I'm sending to) I have:
fputs($fp, $xmlstring);

Then, to receive the response I enter:
$RetValue=fgets($w_socket, 4096);
echo $RetValue;

I am not getting any response, so I have no idea if my XML string is
accepted, rejected or what.  Is this the right way for me to get the
response?  After I send the XML string, they will send me back some info
that will let me know if the transaction is accepted.

-Original Message-
From: Matthew Luchak [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 26, 2001 10:04 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] fsockopen question


I use:

$fp = fsockopen(www.somewhere.com,80); 
fputs($fp, GET http://www.somewhere.com/somedir/somepage.html
HTTP/1.0\r\n\r\n);

to parse.  Should be easily modified

 
Matthew Luchak 
Webmaster
Kaydara Inc. 
[EMAIL PROTECTED]


-Original Message-
From: Michael Conley [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 26, 2001 12:37 PM
To: '[EMAIL PROTECTED]'
Subject: [PHP] fsockopen question



How do I send the XML string to the above URL?  When I use fsockopen, it
doesn't like anything other than an IP address or a host name (ie
www.myprovider.com).  I don't even really see where to force this to go
over
HTTPS.  I set the port to 443, but need to be sure that the data going
across uses SSL.

How do I send this XML string over HTTPS to
https://www.myprovider.com/XMLSubmit/processtrans.asp?


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


Re: [PHP] fsockopen question

2001-04-26 Thread Nuno Silva


Hi,

the way i would do it looks like this:

- setup stunnel (www.stunnel.org) to listen to port 10443 in the 
127.0.0.1 interface and forward that to www.myprovider.com
- the php script would connect to 127.0.0.1:10443 using plain text
- that's it, easy and clean! :)

stunnel will hapilly forward the 127.0.0.1:10443 to the destination 
encripted and you will have to deal with the easy part of it! ;)

Regards,
Nuno Silva



Michael Conley wrote:

 I am looking to process credit card transactions on my site.  In order to do
 this, I need to open a socket to a particular URL.  I then submit an XML
 string to them.  They process the string and send me a response.
 
 I am going to a certain (secure) location on the site of my credit card
 processor (https://www.myprovider.com/XMLSubmit/processtrans.asp) and then
 submit the XML string.  After I submit all of the XML, the processor will
 give me a response as to whether or not the transaction is approved.
 
 How do I send the XML string to the above URL?  When I use fsockopen, it
 doesn't like anything other than an IP address or a host name (ie
 www.myprovider.com).  I don't even really see where to force this to go over
 HTTPS.  I set the port to 443, but need to be sure that the data going
 across uses SSL.
 
 How do I send this XML string over HTTPS to
 https://www.myprovider.com/XMLSubmit/processtrans.asp?
 
 
 
 attachment.txt
 
 Content-Type:
 
 text/plain


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




Re: [PHP] fsockopen timeout not working

2001-02-15 Thread Richard Lynch

Isn't there a set_blocking function you have to call first?...

-- 
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message - 
From: Plamen Slavov [EMAIL PROTECTED]
Newsgroups: php.general
Sent: Wednesday, February 14, 2001 8:40 AM
Subject: [PHP] fsockopen timeout not working


 Hi all,
 Does someone know why fsockopen timeout does not work?
 php3 
 $mydata=fsockopen($machine,$port,$errno,$errstr,30);
 
 I think that this function should fail after 30
 seconds, but it just blocks the script.
 
 __
 Do You Yahoo!?
 Get personalized email addresses from Yahoo! Mail - only $35 
 a year!  http://personal.mail.yahoo.com/
 
 -- 
 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 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]