PHP - proxy checker multi-threaded
I already made my personal single thread proxy checker using php,but I couldnt make it multi-thread,some days ago,I found one checker using multi-thread on github,can someone help to change it to save the good proxies into a file (ip:port format)?
https://raw.githubusercontent.com/samuel-allan/FastProxyChecker/master/checker.php
What i have tried:
original line 91:
echo json_encode($arr);
changed to:
$json = json_decode($arr);
$good_proxie = $json['arr']['result']['proxy']['ip'];
echo "$good_proxie";
php multithreading proxy
add a comment |
I already made my personal single thread proxy checker using php,but I couldnt make it multi-thread,some days ago,I found one checker using multi-thread on github,can someone help to change it to save the good proxies into a file (ip:port format)?
https://raw.githubusercontent.com/samuel-allan/FastProxyChecker/master/checker.php
What i have tried:
original line 91:
echo json_encode($arr);
changed to:
$json = json_decode($arr);
$good_proxie = $json['arr']['result']['proxy']['ip'];
echo "$good_proxie";
php multithreading proxy
add a comment |
I already made my personal single thread proxy checker using php,but I couldnt make it multi-thread,some days ago,I found one checker using multi-thread on github,can someone help to change it to save the good proxies into a file (ip:port format)?
https://raw.githubusercontent.com/samuel-allan/FastProxyChecker/master/checker.php
What i have tried:
original line 91:
echo json_encode($arr);
changed to:
$json = json_decode($arr);
$good_proxie = $json['arr']['result']['proxy']['ip'];
echo "$good_proxie";
php multithreading proxy
I already made my personal single thread proxy checker using php,but I couldnt make it multi-thread,some days ago,I found one checker using multi-thread on github,can someone help to change it to save the good proxies into a file (ip:port format)?
https://raw.githubusercontent.com/samuel-allan/FastProxyChecker/master/checker.php
What i have tried:
original line 91:
echo json_encode($arr);
changed to:
$json = json_decode($arr);
$good_proxie = $json['arr']['result']['proxy']['ip'];
echo "$good_proxie";
php multithreading proxy
php multithreading proxy
edited Nov 21 '18 at 12:14
eduard trionleon
asked Nov 21 '18 at 12:03
eduard trionleoneduard trionleon
102
102
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I did not checked it, but think it'll work ^_^
function CheckMultiProxy($proxies, $timeout, $proxy_type)
{
$data = array();
foreach($proxies as $proxy)
{
$parts = explode(':', trim($proxy));
$url = strtok(curPageURL(),'?');
$data = $url . '?ip=' . $parts[0] . "&port=" . $parts[1] . "&timeout=" . $timeout . "&proxy_type=" . $proxy_type;
}
$results = multiRequest($data);
$holder = array();
foreach($results as $result)
{
$holder = json_decode($result, true)["result"];
}
$arr = array("results" => $holder);
foreach ($arr['results'] as $proxy) {
if ($proxy['success']) {
file_put_contents('YOUR_FILE_HERE', $proxy['proxy']['ip'].':'.$proxy['proxy']['port'].' '.$proxy['proxy']['type'].PHP_EOL, FILE_APPEND);
}
}
echo json_encode($arr);
}
Hello brother , I tried your code but it gives me error "{"results":[null,null,null,null..............." , and no file is created (I set the file name to good-proxies.txt)
– eduard trionleon
Nov 21 '18 at 16:14
can you please give a var_dump of one $proxy in the foreach - so I'll improve it: just put var_dump($proxy) before the file_put_contents - and give the result to me
– myxaxa
Nov 21 '18 at 16:20
the "var_dump($proxy)" returns: "NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL.........) and the original script shows: "{"results":[{"success":true,"proxy":{"ip":"103.21.160.156","port":"9999","speed":3833,"type":"http(s)"}},{"success":true,""
– eduard trionleon
Nov 21 '18 at 17:59
can you check it again - I've updated the post:)
– myxaxa
Nov 22 '18 at 8:35
1
I just have to fix a little error in your last script,i changed this part:foreach ($arr['results'] as $proxy) { ***if ($proxy['success']) {*** file_put_contents('working.txt', $proxy['proxy']['ip'].':'.$proxy['proxy']['port'].PHP_EOL, FILE_APPEND); } }
Now the script is working 100% , thank you very much dude.
– eduard trionleon
Nov 22 '18 at 17:01
|
show 3 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411629%2fphp-proxy-checker-multi-threaded%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I did not checked it, but think it'll work ^_^
function CheckMultiProxy($proxies, $timeout, $proxy_type)
{
$data = array();
foreach($proxies as $proxy)
{
$parts = explode(':', trim($proxy));
$url = strtok(curPageURL(),'?');
$data = $url . '?ip=' . $parts[0] . "&port=" . $parts[1] . "&timeout=" . $timeout . "&proxy_type=" . $proxy_type;
}
$results = multiRequest($data);
$holder = array();
foreach($results as $result)
{
$holder = json_decode($result, true)["result"];
}
$arr = array("results" => $holder);
foreach ($arr['results'] as $proxy) {
if ($proxy['success']) {
file_put_contents('YOUR_FILE_HERE', $proxy['proxy']['ip'].':'.$proxy['proxy']['port'].' '.$proxy['proxy']['type'].PHP_EOL, FILE_APPEND);
}
}
echo json_encode($arr);
}
Hello brother , I tried your code but it gives me error "{"results":[null,null,null,null..............." , and no file is created (I set the file name to good-proxies.txt)
– eduard trionleon
Nov 21 '18 at 16:14
can you please give a var_dump of one $proxy in the foreach - so I'll improve it: just put var_dump($proxy) before the file_put_contents - and give the result to me
– myxaxa
Nov 21 '18 at 16:20
the "var_dump($proxy)" returns: "NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL.........) and the original script shows: "{"results":[{"success":true,"proxy":{"ip":"103.21.160.156","port":"9999","speed":3833,"type":"http(s)"}},{"success":true,""
– eduard trionleon
Nov 21 '18 at 17:59
can you check it again - I've updated the post:)
– myxaxa
Nov 22 '18 at 8:35
1
I just have to fix a little error in your last script,i changed this part:foreach ($arr['results'] as $proxy) { ***if ($proxy['success']) {*** file_put_contents('working.txt', $proxy['proxy']['ip'].':'.$proxy['proxy']['port'].PHP_EOL, FILE_APPEND); } }
Now the script is working 100% , thank you very much dude.
– eduard trionleon
Nov 22 '18 at 17:01
|
show 3 more comments
I did not checked it, but think it'll work ^_^
function CheckMultiProxy($proxies, $timeout, $proxy_type)
{
$data = array();
foreach($proxies as $proxy)
{
$parts = explode(':', trim($proxy));
$url = strtok(curPageURL(),'?');
$data = $url . '?ip=' . $parts[0] . "&port=" . $parts[1] . "&timeout=" . $timeout . "&proxy_type=" . $proxy_type;
}
$results = multiRequest($data);
$holder = array();
foreach($results as $result)
{
$holder = json_decode($result, true)["result"];
}
$arr = array("results" => $holder);
foreach ($arr['results'] as $proxy) {
if ($proxy['success']) {
file_put_contents('YOUR_FILE_HERE', $proxy['proxy']['ip'].':'.$proxy['proxy']['port'].' '.$proxy['proxy']['type'].PHP_EOL, FILE_APPEND);
}
}
echo json_encode($arr);
}
Hello brother , I tried your code but it gives me error "{"results":[null,null,null,null..............." , and no file is created (I set the file name to good-proxies.txt)
– eduard trionleon
Nov 21 '18 at 16:14
can you please give a var_dump of one $proxy in the foreach - so I'll improve it: just put var_dump($proxy) before the file_put_contents - and give the result to me
– myxaxa
Nov 21 '18 at 16:20
the "var_dump($proxy)" returns: "NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL.........) and the original script shows: "{"results":[{"success":true,"proxy":{"ip":"103.21.160.156","port":"9999","speed":3833,"type":"http(s)"}},{"success":true,""
– eduard trionleon
Nov 21 '18 at 17:59
can you check it again - I've updated the post:)
– myxaxa
Nov 22 '18 at 8:35
1
I just have to fix a little error in your last script,i changed this part:foreach ($arr['results'] as $proxy) { ***if ($proxy['success']) {*** file_put_contents('working.txt', $proxy['proxy']['ip'].':'.$proxy['proxy']['port'].PHP_EOL, FILE_APPEND); } }
Now the script is working 100% , thank you very much dude.
– eduard trionleon
Nov 22 '18 at 17:01
|
show 3 more comments
I did not checked it, but think it'll work ^_^
function CheckMultiProxy($proxies, $timeout, $proxy_type)
{
$data = array();
foreach($proxies as $proxy)
{
$parts = explode(':', trim($proxy));
$url = strtok(curPageURL(),'?');
$data = $url . '?ip=' . $parts[0] . "&port=" . $parts[1] . "&timeout=" . $timeout . "&proxy_type=" . $proxy_type;
}
$results = multiRequest($data);
$holder = array();
foreach($results as $result)
{
$holder = json_decode($result, true)["result"];
}
$arr = array("results" => $holder);
foreach ($arr['results'] as $proxy) {
if ($proxy['success']) {
file_put_contents('YOUR_FILE_HERE', $proxy['proxy']['ip'].':'.$proxy['proxy']['port'].' '.$proxy['proxy']['type'].PHP_EOL, FILE_APPEND);
}
}
echo json_encode($arr);
}
I did not checked it, but think it'll work ^_^
function CheckMultiProxy($proxies, $timeout, $proxy_type)
{
$data = array();
foreach($proxies as $proxy)
{
$parts = explode(':', trim($proxy));
$url = strtok(curPageURL(),'?');
$data = $url . '?ip=' . $parts[0] . "&port=" . $parts[1] . "&timeout=" . $timeout . "&proxy_type=" . $proxy_type;
}
$results = multiRequest($data);
$holder = array();
foreach($results as $result)
{
$holder = json_decode($result, true)["result"];
}
$arr = array("results" => $holder);
foreach ($arr['results'] as $proxy) {
if ($proxy['success']) {
file_put_contents('YOUR_FILE_HERE', $proxy['proxy']['ip'].':'.$proxy['proxy']['port'].' '.$proxy['proxy']['type'].PHP_EOL, FILE_APPEND);
}
}
echo json_encode($arr);
}
edited Nov 22 '18 at 17:02
answered Nov 21 '18 at 13:38
myxaxamyxaxa
62036
62036
Hello brother , I tried your code but it gives me error "{"results":[null,null,null,null..............." , and no file is created (I set the file name to good-proxies.txt)
– eduard trionleon
Nov 21 '18 at 16:14
can you please give a var_dump of one $proxy in the foreach - so I'll improve it: just put var_dump($proxy) before the file_put_contents - and give the result to me
– myxaxa
Nov 21 '18 at 16:20
the "var_dump($proxy)" returns: "NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL.........) and the original script shows: "{"results":[{"success":true,"proxy":{"ip":"103.21.160.156","port":"9999","speed":3833,"type":"http(s)"}},{"success":true,""
– eduard trionleon
Nov 21 '18 at 17:59
can you check it again - I've updated the post:)
– myxaxa
Nov 22 '18 at 8:35
1
I just have to fix a little error in your last script,i changed this part:foreach ($arr['results'] as $proxy) { ***if ($proxy['success']) {*** file_put_contents('working.txt', $proxy['proxy']['ip'].':'.$proxy['proxy']['port'].PHP_EOL, FILE_APPEND); } }
Now the script is working 100% , thank you very much dude.
– eduard trionleon
Nov 22 '18 at 17:01
|
show 3 more comments
Hello brother , I tried your code but it gives me error "{"results":[null,null,null,null..............." , and no file is created (I set the file name to good-proxies.txt)
– eduard trionleon
Nov 21 '18 at 16:14
can you please give a var_dump of one $proxy in the foreach - so I'll improve it: just put var_dump($proxy) before the file_put_contents - and give the result to me
– myxaxa
Nov 21 '18 at 16:20
the "var_dump($proxy)" returns: "NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL.........) and the original script shows: "{"results":[{"success":true,"proxy":{"ip":"103.21.160.156","port":"9999","speed":3833,"type":"http(s)"}},{"success":true,""
– eduard trionleon
Nov 21 '18 at 17:59
can you check it again - I've updated the post:)
– myxaxa
Nov 22 '18 at 8:35
1
I just have to fix a little error in your last script,i changed this part:foreach ($arr['results'] as $proxy) { ***if ($proxy['success']) {*** file_put_contents('working.txt', $proxy['proxy']['ip'].':'.$proxy['proxy']['port'].PHP_EOL, FILE_APPEND); } }
Now the script is working 100% , thank you very much dude.
– eduard trionleon
Nov 22 '18 at 17:01
Hello brother , I tried your code but it gives me error "{"results":[null,null,null,null..............." , and no file is created (I set the file name to good-proxies.txt)
– eduard trionleon
Nov 21 '18 at 16:14
Hello brother , I tried your code but it gives me error "{"results":[null,null,null,null..............." , and no file is created (I set the file name to good-proxies.txt)
– eduard trionleon
Nov 21 '18 at 16:14
can you please give a var_dump of one $proxy in the foreach - so I'll improve it: just put var_dump($proxy) before the file_put_contents - and give the result to me
– myxaxa
Nov 21 '18 at 16:20
can you please give a var_dump of one $proxy in the foreach - so I'll improve it: just put var_dump($proxy) before the file_put_contents - and give the result to me
– myxaxa
Nov 21 '18 at 16:20
the "var_dump($proxy)" returns: "NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL.........) and the original script shows: "{"results":[{"success":true,"proxy":{"ip":"103.21.160.156","port":"9999","speed":3833,"type":"http(s)"}},{"success":true,""
– eduard trionleon
Nov 21 '18 at 17:59
the "var_dump($proxy)" returns: "NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL.........) and the original script shows: "{"results":[{"success":true,"proxy":{"ip":"103.21.160.156","port":"9999","speed":3833,"type":"http(s)"}},{"success":true,""
– eduard trionleon
Nov 21 '18 at 17:59
can you check it again - I've updated the post:)
– myxaxa
Nov 22 '18 at 8:35
can you check it again - I've updated the post:)
– myxaxa
Nov 22 '18 at 8:35
1
1
I just have to fix a little error in your last script,i changed this part:
foreach ($arr['results'] as $proxy) { ***if ($proxy['success']) {*** file_put_contents('working.txt', $proxy['proxy']['ip'].':'.$proxy['proxy']['port'].PHP_EOL, FILE_APPEND); } }
Now the script is working 100% , thank you very much dude.– eduard trionleon
Nov 22 '18 at 17:01
I just have to fix a little error in your last script,i changed this part:
foreach ($arr['results'] as $proxy) { ***if ($proxy['success']) {*** file_put_contents('working.txt', $proxy['proxy']['ip'].':'.$proxy['proxy']['port'].PHP_EOL, FILE_APPEND); } }
Now the script is working 100% , thank you very much dude.– eduard trionleon
Nov 22 '18 at 17:01
|
show 3 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411629%2fphp-proxy-checker-multi-threaded%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown