<?php //my perfect cURL in PHP $proxies = array(); //Declaring an array to store the proxy list //Adding list of proxies to the $proxies array $proxies[] = 'user:password@173.234.11.134:54253'; //Some proxies require user, password, IP and port number $proxies[] = '173.234.92.107'; //Some proxies only require IP $proxies[] = '173.234.94.90:54253'; //Some proxies require IP and port number //Choose a random proxy from our proxy list if(isset($proxies)){ $proxy = $proxies[array_rand($proxies)]; //Select a random proxy from the array and assign to $proxy variable } $post_fields = array('id' => 1, 'name' => 'moko', 'status' => true); $postvars = ""; foreach($post_fields as $key => $value) { $postvars .= $key."=".$value."&"; } $ch = curl_init(); //Initialise a cURL handle if(isset($proxy)){ curl_setopt($ch, CURLOPT_PROXY, $proxy); //Set CURLOPT_PROXY with proxy in $proxy variable } // Set any other cURL options that are required curl_setopt($ch, CURLOPT_HEADER, FALSE); //Set Header if available curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); //Disable verifying of SSL certificate curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE); //Enable cookie session curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); //Follow any redirect from the URL curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE; //Give us a feedback from the URL accessed curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); //Similar to the SSL rule above curl_setopt($ch, CURLOPT_TIMEOUT, 30); //Time limit of loading, shut it down if it exceeds curl_setopt($ch, CURLOPT_POST, TRUE); //Use HTTP Post method, False for GET curl_setopt($ch, CURLOPT_REFERER, "https://google.com/"); //Provide referrer URL, must be string curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Linux x86_64; rv:2.2a1pre) Gecko/20110324 Firefox/4.2a1pre"); curl_setopt($ch, CURLOPT_VERBOSE, 0); //Turn verbose off curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars); //Post values curl_setopt($ch, CURLOPT_URL, $url); $result = curl_exec($ch); //Execute a cURL request ?>