Here's my php code
<?php
$s = $_POST['s'];
header("Location: " . $s);
exit();
?>
Is it possible to execute this code using a url? I tried mywebsite.com/code.php?s=www.google.com
but it doesn't redirect me to google.
Any variables on the querystring of a URL are accessible via $_GET
. ( $_POST
can be used to access form fields in the body of a request.)
Therefore
$s = $_GET['s'];
should work for you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.