Search
 
SCRIPT & CODE EXAMPLE
 

PHP

curl php loop

function Curl($url){
    $total_curl = 1;
    $isRunning = true;
    $sleep = 1;
    while ($isRunning){
        $curl = curl_init($url);
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_REFERER, $this->url ?? $url);

        //for debug only!
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_TIMEOUT,10);

        $resp = curl_exec($curl);

        if((!$resp || curl_errno($curl))){
            if($total_curl > 3){
                $isRunning = false;
            }

            sleep($sleep);
        }

        curl_close($curl);
        $total_curl++;
    }
    
    return $resp;
}
Comment

PREVIOUS NEXT
Code Example
Php :: wp_customize_image_control 
Php :: Laravel Eloquent Query Using WHERE with OR AND OR? 
Php :: string match percentage php 
Php :: laravel joins eloquent model 
Php :: laravel attach once 
Php :: php get keys of duplicate values in array 
Php :: uninstall phpstorm ubuntu 
Php :: get data of url php 
Php :: laravel query foreach 
Php :: foreach date php 
Php :: php var_dump more readable 
Php :: valid image extensions in php 
Php :: carbon greater than 
Php :: grouping routes based on controller laravel 
Php :: php get last digit of number 
Php :: taxonomy_get_parents drupal 8 
Php :: wherein elequent 
Php :: like %% inside the array php 
Php :: PHP similar_text — Calculate the similarity between two strings 
Php :: wordpress display menu by name 
Php :: filesize in php 
Php :: get google map api 
Php :: php sort multidimensional array by key 
Php :: wordpress how to match password 
Php :: wordpress remove taxonomy from post 
Php :: php invoke 
Php :: insertion sort in php 
Php :: random integer in php 
Php :: filter array in php with passing extra params 
Php :: sql update row in php 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =