I have a PHP script that calls our server running IIS 10 on different specified ports. It is PHP version 7.3.12. I am running this script from a shelled out windows process by doing "php.exe script.php", not from a browser request. When I change ports within about a minute, it is keeps sending to the first port specified.
As an example, if I run the script 3 times doing these 3 iterations in a row:
$result = file_get_contents('https://example.com:6447/token', false, $context);
$result = file_get_contents('https://example.com:6453/token', false, $context);
$result = file_get_contents('https://example.com:6447/token', false, $context);
and check the logs, they all are logged under 6447.
I tried the exact same thing with postman and it works as expected. the first and third ones log under 6447 and the second under 6453.
I then tried copying the script and running them separately and it still posts to the wrong port.
Is there something I need to do to close the connection or something. I am stumped.
Ok, we solved it. Here are the notes:
Thank you to Barmar for working through this with me and pointing me in the right direction.