12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- function get_hidden_service_results($query)
- {
- global $config;
- // Randomly choose a instance
- $results = array();
- $num = array_rand($config->instances);
- $instance = $config->instances[$num];
- $url = "https://$instance/api.php";
- // API POST field
- $post_string = "q=$query&t=4";
- $api_ch = curl_init($url);
- curl_setopt_array($api_ch, $config->curl_settings);
- curl_setopt($api_ch, CURLOPT_CUSTOMREQUEST, "POST");
- curl_setopt($api_ch, CURLOPT_COOKIE, http_build_query($cookies, '', ';'));
- curl_setopt($api_ch, CURLOPT_POSTFIELDS, $post_string);
- $results = json_decode(curl_exec($api_ch),true);
- if($results == null) $results = "$instance is broken";
- return $results;
- }
- function print_hidden_service_results($results)
- {
- echo "<div class=\"text-result-container\">";
- foreach($results as $result)
- {
- $title = $result["title"];
- $url = $result["url"];
- $base_url = $result["base_url"];
- $description = $result["description"];
- echo "<div class=\"text-result-wrapper\">";
- echo "<a href=\"$url\">";
- echo "$base_url";
- echo "<h2>$title</h2>";
- echo "</a>";
- echo "<span>$description</span>";
- echo "</div>";
- }
- echo "</div>";
- }
- ?>
|