[PHP] Fsockopen error

2005-11-01 Thread Robert Prentice
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

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