Jump to content

Recommended Posts

Okay here is the thing...  i know how to add proxys

 

curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt($ch, CURLOPT_PROXY,"[i][b]PROXYHERE[/b][/i]");

 

Here are my questions.. What kind of proxy dose it use? ( Sock5? http? Sock4? ect..)

 

Okay second here the php part. I need it to read a txt file on the server called proxylist.txt

 

and randomly pick a proxy from it but after it picks it. it has to remove it from the TXT file.

 

Help!?@!

Link to comment
https://forums.phpfreaks.com/topic/184741-curl-proxy/
Share on other sites

The text file portion is actually really easy:

<?php
$proxyArr = file('proxies.txt');
$randProxy = array_rand($proxyArr);
$proxy = $proxyArr[$randProxy];
unset($proxyArr[$randProxy]);

$fh = fopen('proxies.txt', 'w+');
foreach ($proxyArr as $write) 
fwrite($fh, $write);
fclose($fh);

// other code here
echo $proxy;
?>

 

If you are using a database it is actually quite a bit easier then that.

 

Link to comment
https://forums.phpfreaks.com/topic/184741-curl-proxy/#findComment-975627
Share on other sites

as the other users already told it is quite risky to use the text file.use a database instead and make a column so that u can make it as 1 once u use it off.

<?
//$url = 'http://www.whatismyip.com/';
$url='http://www.ip-adress.com/what_is_my_ip/';
$cUrl = curl_init();
curl_setopt($cUrl,CURLOPT_VERBOSE,1);
//curl_setopt($cUrl,CURLOPT_HTTPPROXYTUNNEL,true);
curl_setopt($cUrl,CURLOPT_PROXYTYPE,CURLPROXY_HTTP);
curl_setopt($cUrl,CURLOPT_PROXY,'208.43.64.236:808');
curl_setopt($cUrl,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($cUrl,CURLOPT_URL,$url);
curl_setopt($cUrl,CURLOPT_TIMEOUT,320);
$PageContent = curl_exec($cUrl);

curl_close($cUrl);
echo $PageContent;

?>

 

so at the proxy number which i have specified u can use the random one.

 

Link to comment
https://forums.phpfreaks.com/topic/184741-curl-proxy/#findComment-976787
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.