shit code (that really saves the day)
root.php
Yo, this code a class that hooks up sessions for scripts that need a login, so you ainβt gotta create a new acct every time, no cap, it logs in with one account, stashes the session cookies, and then reuses those cookies for authenticated requests without logging in again, makes automating ur tasks way easier, keeping the session alive all the time, soon in python or whatever
So this is a beta version of a quick idea that popped up cause coders are ditching sites with logins, Iβll be dropping updates on the regular, If you got any suggestions, hit me up, i gotchu
This media is not supported in your browser
VIEW IN TELEGRAM
This media is not supported in your browser
VIEW IN TELEGRAM
π4π±3π₯1
This media is not supported in your browser
VIEW IN TELEGRAM
Mat reference.
<?php
function tr(string $sl, string $tl, string $txt): array {
if (empty($sl) || empty($tl)) return ['c' => false, 'e' => 'Lang. req.'];
if (empty($txt)) return ['c' => false, 'e' => 'Txt. req.'];
if ($sl === $tl) return ['c' => false, 'e' => 'Same lang.'];
if (mb_strlen($txt) > 3000) return ['c' => false, 'e' => 'Txt. too long'];
$et = urlencode($txt);
$url = "https://translate.googleapis.com/translate_a/single?client=gtx&sl={$sl}&tl={$tl}&dt=t&q={$et}";
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_ENCODING => 'UTF-8',
CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36',
]);
$out = curl_exec($ch);
$hc = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($out === false || $hc != 200) return ['c' => false, 'e' => 'Trans. err.'];
$resp = json_decode($out, true);
if ($resp === null) return ['c' => false, 'e' => 'Inv. resp.'];
$trTxt = '';
foreach ($resp[0] as $part) $trTxt .= $part[0];
$detSl = $resp[2];
return [
'c' => true,
'm' => $trTxt,
'i' => $txt,
'in' => strtoupper($detSl),
'ou' => strtoupper($tl),
];
}
$res = tr('auto', 'pt', 'STUPID HUMANS');
if (!$res['c']) echo "Error: " . $res['e'] . "\n";
else {
echo "Lang.: " . $res['in'] . "\n";
echo "Input: " . $res['i'] . "\n";
echo 'Text: ' . $res['m'] . "\n";
}
?>
π€―3π±2β€βπ₯1π
1
shit code (that really saves the day)
<?php function tr(string $sl, string $tl, string $txt): array { if (empty($sl) || empty($tl)) return ['c' => false, 'e' => 'Lang. req.']; if (empty($txt)) return ['c' => false, 'e' => 'Txt. req.']; if ($sl === $tl) return ['c' => false, 'e' =>β¦
This media is not supported in your browser
VIEW IN TELEGRAM
This media is not supported in your browser
VIEW IN TELEGRAM
shit code (that really saves the day)
a mi dm
Puto VEnrex