Jump to content

fsockopen help


zymo

Recommended Posts

I am trying to put a page together for an internal application that can monitor the state of our internal web apps. This all works okay when looking at non-ssl sites but when trying to check the status of ssl sites I am having problems.

 

In this example code I am using ebay.com as I get the same http response code:

 

<?php
$server = "ssl://signin.ebay.com";
$port = 443;
$fp=fsockopen($server,$port,$errno,$errstr,5);

$page = "ws/eBayISAPI.dll?SignIn&ru=http%3A%2F%2Fwww.ebay.com%2F";
$out="GET /$page HTTP/1.1\r\n"; 
$out.="Host: $server\r\n"; 
$out.="Connection: Close\r\n\r\n";
fwrite($fp,$out);

echo $out."<br>";

$content=fgets($fp);
$status = trim(strtolower($content));

echo $status."<br>";

if ($status == "http/1.1 200 apple") {
?> Status: <img src="images/accept.png"><?php
} else {
?> Status: <img src="images/cross.png"><?php
}

 

When executed the following response is given:

 

GET /ws/eBayISAPI.dll?SignIn&ru=http%3A%2F%2Fwww.ebay.com%2F HTTP/1.1 Host: ssl://signin.ebay.com Connection: Close

http/1.1 400 bad request

 

Any help would be greatly appreciated.

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/194358-fsockopen-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.