purpleslurple / PurpleSlurple

PurpleSlurple transcodes web pages to make them granularly accessible.
GNU General Public License v2.0
0 stars 0 forks source link

MTOT Test Code #68

Closed purpleslurple closed 11 months ago

purpleslurple commented 11 months ago

MTOT Cardinality 4.75e+38

purpleslurple commented 11 months ago

https://chat.openai.com/share/d76cbf7e-7d1b-47a8-b09f-36dde5f70998

purpleslurple commented 11 months ago

https://onedrive.live.com/view.aspx?resid=F4873BF54ECA028%2110983&id=documents&wd=target%28MTOT.one%7C99AFFF12-5685-4B73-9BB3-9B8005C2488A%2FMTOT%20Cardinality%204.75e%2B38%7C57286820-0BCD-4607-87C4-3647FAD96364%2F%29 onenote:https://d.docs.live.net/0f4873bf54eca028/Documents2/MatthewSchneiderDeveloper/MTOT.one#MTOT%20Cardinality%204.75e+38&section-id={99AFFF12-5685-4B73-9BB3-9B8005C2488A}&page-id={57286820-0BCD-4607-87C4-3647FAD96364}&end

purpleslurple commented 11 months ago

<?php $urls = array( "https://example.com/page1", "https://example.com/page2", // Add more URLs here );

$totalUrls = count($urls); $matchedCount = 0;

foreach ($urls as $url) { // Retrieve the web page content $webContent = file_get_contents($url);

// Extract all words from the content
$words = str_word_count(strip_tags($webContent), 1);

// Select a random starting point for 8 consecutive words
$startIndex = mt_rand(0, count($words) - 8);

// Get the next 8 consecutive words
$randomString = implode(" ", array_slice($words, $startIndex, 8));

// Wrap the random string in quotes
$quotedString = '"' . $randomString . '"';

// Send the query to Google
$googleQuery = "https://www.google.com/search?q=" . urlencode($quotedString);

// Get the URL of the first result from Google
$googleResults = file_get_contents($googleQuery);
preg_match('/<a href="\/url\?q=(.*?)&/', $googleResults, $match);
$googleResultURL = urldecode($match[1]);

// Compare the URLs
$matchCondition = ($googleResultURL === $url) ? "Match" : "No match";

// Print the results
echo "Current URL: $url<br>";
echo "Quoted String: $quotedString<br>";
echo "First Google result: $googleResultURL<br>";
echo "Match condition: $matchCondition<br><br>";

if ($matchCondition === "Match") {
    $matchedCount++;
}

}

$matchPercentage = ($matchedCount / $totalUrls) * 100; echo "Percentage matched: $matchPercentage%"; ?>

purpleslurple commented 11 months ago

https://chat.openai.com/share/91eca972-b047-49b0-83d1-df76cd971f5a