Created
April 1, 2023 18:36
-
-
Save vpnry/dd572d4a8355ec146186d6a683ef5082 to your computer and use it in GitHub Desktop.
phpwin iPadOS browser
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 | |
| // Generated with the support of ChatGPT | |
| // This script is to be used with phpwin app on iPadOS | |
| // To add dictionary funtions on the HTML web page | |
| // Check if the user has submitted a URL | |
| if(isset($_POST['url'])) { | |
| // Retrieve the URL from the form input | |
| $url = $_POST['url']; | |
| // Set the referer and user agent headers | |
| $headers = array( | |
| 'Referer: ' . $_SERVER['HTTP_HOST'], | |
| 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36' | |
| ); | |
| // Fetch the contents of the URL using cURL | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_URL, $url); | |
| curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
| $content = curl_exec($ch); | |
| curl_close($ch); | |
| // Replace links in the content to open in the proxy | |
| $content = str_replace('href="', 'href="/?url=', $content); | |
| // Add JavaScript to the content | |
| $content .= '<script src="./dictionary/dict_script.user.js"></script>'; | |
| // Display the contents of the requested URL | |
| echo $content; | |
| } | |
| ?> | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>PHP Web Proxy</title> | |
| <style> | |
| form { | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| height: 100vh; | |
| } | |
| input[type="text"] { | |
| width: 80%; | |
| font-size: 18px; | |
| padding: 10px; | |
| border: 1px solid #ccc; | |
| border-radius: 5px; | |
| margin-right: 10px; | |
| } | |
| input[type="submit"], button { | |
| background-color: #4CAF50; | |
| color: white; | |
| font-size: 18px; | |
| padding: 10px 20px; | |
| border: none; | |
| border-radius: 5px; | |
| cursor: pointer; | |
| } | |
| input[type="submit"]:hover, button:hover { | |
| background-color: #45a049; | |
| } | |
| body { | |
| font-size: large; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <form method="POST"> | |
| <button type="button" onclick="pasteUrl()">Paste</button> | |
| <input type="text" id="url-input" name="url" placeholder="Enter URL"> | |
| <input type="submit" value="Go"> | |
| </form> | |
| <script> | |
| function pasteUrl() { | |
| navigator.clipboard.readText() | |
| .then(text => { | |
| document.getElementById("url-input").value = text; | |
| }) | |
| .catch(err => { | |
| console.error('Failed to read clipboard contents: ', err); | |
| }); | |
| } | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment