Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="POST" action="">
- <label for="url-input">Insira uma URL:</label>
- <input type="text" id="url-input" name="url">
- <button type="submit" name="submit">Obter título</button>
- </form>
- <p id="title">
- <?php
- if (isset($_POST['submit'])) {
- $url = $_POST['url'];
- $html = file_get_contents($url);
- $title = preg_match('/<title>(.*)<\/title>/', $html, $matches);
- echo $matches[1];
- }
- ?>
- </p>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement