Jump to content
pr00f

[PHP] Get proxy list

Recommended Posts

Un mic script ce preia lista de proxy-uri de pe primele cinci pagini (sau oricâte, dar în primele cinci sunt mai fresh), în format ip:port de pe hidemyass.com.



<?php

for ($page = 1; $page <= 5; $page++) { // Numarul paginilor.

$content = file_get_contents("http://hidemyass.com/proxy-list/".$page); // Url-ul cu pagina.
$start1 = "<td><span>"; // Preluam ip ...
$end1 = "</td>

<td rel="; // ... pana aici.

$start2 = '" alt="flag" /> '; // Preluam port ...
$end2 = '</span></td>'; // ... pana aici.

for ($i = 1; $i <= 50; $i++) { // 50 proxy-uri per pagina.

$r = explode($start1, $content);
if (isset($r[$i])){
$r = explode($end1, $r[$i]);
echo str_replace("</span></td>
<td>
", ":", $r[0]) . "<br>"; // Scriem ip:port

}

}

}

?>

Edited by pr00f
Link to comment
Share on other sites

Simplu si la obiect. Ca idee(nu prea stiu php) se pot folosi regex pentru determinarea de IP : PORT in $content, iar adresa sa fie transmisa prin parametru. Ex: /script.php?content=http://hidemyass.com/proxy-list&maxpage=5

Regex pt IP


$string = "255.255.255.255";
if (preg_match(
'/^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:[.](?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$/',
$string)) {
echo "IP address is good.";
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...