Hello, iam almost done with my project .. except there is one more thing left which somehow i cant manage to figure it out....... i manged to make a proxy array which rotates proxies randomly on every try..... but i want for my users to be able to add them manually via the textarea... so they put their proxies and
as much as they want...... so then i gues explode should be used to fetch the proxies that were added by the user from the textarea and put them in an array like u see down and then with the curl array_rand it randomises them on evry try............ THNX IN ADVANCE.........

$proxies = array(
    '000.000.000.00:000',
    '000.000.000.00:000',
    '000.000.000.00:000',
    '000.000.000.00:000',

);
curl_setopt($ch, CURLOPT_PROXY,$proxies[array_rand($proxies)]);

<textarea cols='22' class='area' rows='14' name='proxies'>PROXIES</textarea><br><input type='submit' value='Test'><br></p><p align='center' dir='ltr'><b>

    Welcome to PHPBuilder!

    It looks like you forgot to actually ask a question. What's your question?

      bradgrafelman;11042629 wrote:

      Welcome to PHPBuilder!

      It looks like you forgot to actually ask a question. What's your question?

      What exactly is not clear :v i would like ........ the explode to take what is written in textarea and make them as array so that it can use them randomly them 🙂

        You may have better luck with [man]preg_split/man, so that you can use a regular expression for the delimiter, e.g.:

        // split on any kind of white-space:
        $parts = preg_split('/\s+/', $input);
        

          Well i think u didnt get my question, my question is how do i fetch the values from the textarea and add them to an array so it uses the values randomly on evry try.........

            So what does the submitted value of the text area field look like? Is that a bunch of [noparse]ip4:port[/noparse] numbers (which would be separated by whitespace)?

              Exactly 🙂 evry proxy is entered on a new line 🙂 if nth is entered use the local ip adress 🙂

                Have a look at example 1 on the [man]preg_split[/man] manual page.

                  Well i changed the script a little bit now.........
                  i want to get the proxies from a txt file........
                  i tried this
                  $path = './proxies.txt';

                  $proxies = array();
                  foreach(file($path, FILE_SKIP_EMPTY_LINES) as $line) {
                  $proxy = trim($line);
                  list($ip, $port) = explode(':', $proxy);

                  $proxies[$ip] = $port;
                  }

                  var_dump($proxies);
                  and then get proxies from array and randomising them using
                  curl_setopt($ch, CURLOPT_PROXY,$proxies[array_rand($proxies)]);
                  I HOPE U CAN HELP

                    Your forum posting technique could use a little work:
                    1) Use code formatting tags rather than just pasting your code in the page
                    2) Describe your problem better.

                    So you tried this code:

                    $path = './proxies.txt';
                    
                    $proxies = array();
                    foreach(file($path, FILE_SKIP_EMPTY_LINES) as $line) {
                    $proxy = trim($line);
                    list($ip, $port) = explode(':', $proxy);
                    
                    $proxies[$ip] = $port;
                    }
                    
                    var_dump($proxies);
                    and then get proxies from array and randomising them using
                    curl_setopt($ch, CURLOPT_PROXY,$proxies[array_rand($proxies)]);
                    

                    You could start be describing what it does right, what it does wrong, and what else you want it to do.

                      Write a Reply...