This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # python_data_structures.py | |
| # | |
| # Description: A quick reference and example guide for the basic built-in | |
| # data structures in Python: Lists, Tuples, Dictionaries, and Sets. | |
| # --- 1. Lists --- | |
| # An ordered and mutable (changeable) collection of items. | |
| # Use cases: Storing collections of items that might need to change, | |
| # like a to-do list or a list of users. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Get the client's IP address | |
| $ip = $_SERVER['REMOTE_ADDR']; | |
| echo "Request IP: " . $ip . "<br><br>"; | |
| echo "<h3>Method 1: Using cURL</h3>"; | |
| // Method 1: Using cURL | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
| curl_setopt($ch, CURLOPT_URL, "http://ipinfo.io/" . $ip . "/json"); |