Skip to main content

MVS Toolkit, PHP and HTTPS

  • May 10, 2022
  • 0 replies
  • 0 views

Brian Cram
Forum|alt.badge.img+3
A friend of mine got bit by an upgrade from PHP 5 to PHP 7. He was accessing the MVS Toolkit from PHP by creating a URI and retrieving data by passing that URI to file_get_contents then parsing the returned JSON object as follows:

$uri = "https://xx.xx.xx.xx:8181/ws/wso?param=whatever";
$jsonStr = file_get_contents($uri);

Because security has become a lot tighter over the last few years, that code resulted in an SSL failure error. He was able to correct this by adding the following code:

$uri = "https://xx.xx.xx.xx:8181/ws/wso?param=whatever";
$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
);
$jsonStr = file_get_contents($uri, false , stream_context_create($arrContextOptions));

------------------------------
Brian S. Cram
Principal Technical Support Engineer
Rocket Software
------------------------------