"; $response .= "

Authorization Successful!

"; $response .= "

Authorization code received. You can close this window.

"; $response .= "

Code: $auth_code

"; $response .= "

Copy this code and paste it in the terminal.

"; $response .= ""; fwrite($conn, $response); fclose($conn); echo "Authorization code received: $auth_code\n"; echo "Copy this code to your terminal.\n"; // Keep server running to display the page sleep(10); break; } else { // Send 404 for other requests $response = "HTTP/1.1 404 Not Found\r\n"; $response .= "Content-Type: text/html\r\n\r\n"; $response .= "

404 Not Found

"; fwrite($conn, $response); fclose($conn); } } fclose($server); echo "\nServer stopped.\n";