Praticamente sto realizzando uno piccolo script che agisce sulla sorgente di un forum presente su ForumFree o ForumCommunity o BlogFree, solo che il mio primo problema è assicurare che nel form text sia inserito un id numerico che non contenga ne caratteri e ne lettere solo numeri mentre il secondo è il cURL che mi mostra Destination host forbidden che tipo di problema può esserci dato che mi sembra di aver settato tutto bene (a parte la Regex).
Questo è l'index.html
codice:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Auto Archive</title>
</head>
<body>
<form action="action.php" method="post">
<select name="circuito">
<option value="forumfree.it/?f=">ForumFree</option>
<option value="forumcommunity.net/?f=">ForumCommunity</option>
<option value="blogfree.net/?f=">BlogFree</option>
</select>
<input type="text" name="id">
<input type="submit" value="Procedi">
</form>
</body>
</html>
Questo il PHP
Codice PHP:
<?php
error_reporting(E_ALL);
if (preg_match('/^[0-9a-z]/i', $_POST['id'])) {
$url = "http://www." .$_POST['circuito'] .$_POST['id'];
$host = curl_init($url);
curl_setopt($host, CURLOPT_USERAGENT, "Auto-Archive");
$result = curl_exec($host);
curl_close($host);
}
else {
echo "[b]Attenzione:[/b] sono stati inseriti caratteri non validi, devi inserire un [b]ID[/b] valido.";
}
?>