Re: [PHP] fsockopen error messages
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! "; echo "Error: $errstr ($errno)\n"; } ?> Thanks, ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fsockopen error messages
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!"; > echo "Error: $errstr ($errno)\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
[PHP] fsockopen error messages
Hi. I have not dealt much with fsockopen, but after looking at many examples, I'm not finding the answers I need. fsockopen is not returning anything and I'm trying to find out what the issue is. The error messages are not provided and I'm not sure what's going on. Help please! "; echo "Error: $errstr ($errno)\n"; } ?> Thanks, ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fsockopen error
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 error
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
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
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
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
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
[PHP] Fsockopen error
I am attempting to connect to a remote server using fsockopen to post data to a php file. Here is the error i get: Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known (is your IPV6 configuration correct? If this error happens all the time, try reconfiguring PHP using -- disable-ipv6 option to configure) in /home/customerservice/docs/ admin_ahmed/test.php on line 37 Here is the code i am using: $reply = http_post("https://www.safetrustprocessing.com";, 80, "/ xml_order_processing.php", array("myXml" => $xml)); function http_post ($server, $port, $url, $vars) { $user_agent = "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)"; $urlencoded = ""; while (list($key,$value) = each($vars)) $urlencoded.= urlencode($key) . "=" . urlencode($value) . "&"; $urlencoded = substr($urlencoded,0,-1); $content_length = strlen($urlencoded); $headers = "POST $url HTTP/1.1 Accept: */* Accept-Language: en-au Content-Type: application/x-www-form-urlencoded User-Agent: $user_agent Host: $server Connection: Keep-Alive Cache-Control: no-cache Content-Length: $content_length "; $fp = fsockopen($server, $port, $errno, $errstr); if (!$fp) { return false; } fputs($fp, $headers); fputs($fp, $urlencoded); $ret = ""; while (!feof($fp)) $ret.= fgets($fp, 1024); fclose($fp); return $ret; } Any ideas on the problem? Robert