Example #1
0
function get_fbcount($host, $path, $file)
{
    $content = httpSocketConnection($host, 'GET', $path, NULL);
    $fp = fopen($file, "w");
    fwrite($fp, $content);
    fclose($fp);
}
Example #2
0
 static function searchInAur($searchArray)
 {
     $GLOBALS['aur_matches'] = array();
     /*
     AUR FORMS (partial information)
     O: start index
     	[number]: value
     L: Location
     	0: Any
     	2: unsupported
     	3: community
     C: Category
     	0: Any
     K: Search string
     PaS: Status
     	all: all
     	fs: safe
     	us: unsafe
     SB: Search By
     	n: name
     SO: Sort Order
     	a: ascending
     	d: descending
     PP: Per Page
     	[number]: results per page
     */
     $resultsPerPage = 100;
     $PaS = '******';
     if ($GLOBALS['onlySafeAurResults']) {
         $PaS = '******';
     } else {
         $startIndex = 0;
     }
     $doMore = '';
     while ($startIndex == 0 || $doMore) {
         $responseRaw = httpSocketConnection('aur.archlinux.org', 'POST', '/packages.php', 'O=' . $startIndex . '&L=2&C=0&K=' . urlencode($searchArray[0]) . '&PaS='******'&SB=n&SO=a&PP=' . $resultsPerPage);
         $startIndex += $resultsPerPage;
         if (stripos($responseRaw, 'name=\'do_More\'') !== false) {
             $doMore = '&do_More=' . urlencode('More -->');
         } else {
             $doMore = '';
         }
         $response = split('  <td class=\'data.\'><span class=\'f5\'><span class=\'blue\'>unsupported</span></span></td>', $responseRaw);
         array_splice($response, 0, 1);
         foreach ($response as $test) {
             //$test=$response[0];
             $packageData = array();
             if (strpos($test, '<span class=\'green\'>') !== false) {
                 $packageData['safe'] = ' (SAFE)';
             }
             $test = strip_tags($test);
             $test = split("\n", $test);
             $tmpData = preg_replace('/^\\ */', '', $test[2]);
             $tmpData = split(' ', $tmpData);
             $packageData['name'] = $tmpData[0];
             $packageData['version'] = $tmpData[1];
             $packageData['desc'] = preg_replace('/^\\ */', '', $test[4]);
             $packageData['installed'] = 'false';
             if (PacmanData::checkIfSearchMatches($searchArray, $packageData)) {
                 $GLOBALS['aur_matches'][$packageData['name']] = $packageData;
             }
         }
     }
 }