Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execute HTTP Post automatically

Tags:

php

cron

I have a free script and I would like to ask if it's possible to replace or automate the search function. For example every hour. Right now I have to press the search button to find new proxies but I want to search automatically and update them in my database, maybe using a cron job.

if(isset($_POST['search'])) {   // hit search button
    $script_start = $pb->microtime_float();

    ob_flush();
    flush();

    $proxylisttype = $pb->returnProxyList($_REQUEST['listtype']);  // make sure request vars are clean
    $sitestoscour  = $pb->returnSitesScour($_REQUEST);             // make sure request vars are clean
    $finallist     = $pb->returnFinalList($sitestoscour);
    $finallist     = $pb->arrayUnique($finallist);                 // eliminate the dupes before moving on
    if(AUTO_BAN == 1) {                                            // remove banned proxies
        $finallist = $pb->autoBan($finallist);
    }
    $script_end    = $pb->microtime_float();                       // stop the timer
}
like image 938
NR03 Avatar asked Jul 18 '26 14:07

NR03


1 Answers

You can either do it with curl from a php script or command line (or wget). That way you can set the $_POST:

$ch = curl_init();

curl_setopt($ch,CURLOPT_URL, "http://yoururl.com'");
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS, "search=your_query");

$result = curl_exec($ch);

curl_close($ch);

Then make that script run every hour by setting up a cron job.

You could also do it with wget:

wget --post-date="search=query" http://yoururl.com
like image 97
Nin Avatar answered Jul 21 '26 02:07

Nin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!