$file = file("sitemap.txt"); $count = count($file); $num = "100"; $random_keys = array_rand($file,$num); $urls = array(); for($i = 0 ; $i<$num; $i++){ $urls[]=$file[$random_keys[$i]]; } $api = '; $ch = curl_init(); $options = array( CURLOPT_URL => $api, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => implode("\n", $urls), CURLOPT_HTTPHEADER => array('Content-Type: text/plain'), ); curl_setopt_array($ch, $options); $result = curl_exec($ch); echo $result;