Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Thursday, December 9, 2021

PHP web scrap link simple

 https://www.endpointdev.com/blog/2016/07/scrape-web-content-with-php-no-api-no/


Windows 10 & 11 Sound Keyboard Application free download

https://www.benibela.de/sources_en.html#internettools

https://stackoverflow.com/questions/14691782/web-page-scraping-in-delphi

https://www.rosettacode.org/wiki/Web_scraping

http://videlibri.sourceforge.net/xidel.html




unit main;{$mode objfpc}{$H+}interfaceuses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
fphttpclient, regexpr;
type{ TForm1 }TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure downloadBook(bookname: String);
private
publicend;var
Form1: TForm1;
implementation{$R *.lfm}{ TForm1 }const
baseUrl = 'https://beogradsko.blogspot.com/';
var
targetDirectory: AnsiString;
procedure TForm1.Button1Click(Sender: TObject);
var
page, bookname: AnsiString;
re: TRegExpr;
begin
targetDirectory := GetUserDir + 'downloads' + DirectorySeparator + 'GoalKickerBooks' + DirectorySeparator;
if Not DirectoryExists(targetDirectory) then
CreateDir(targetDirectory);
// Grab the base page
page := TFPHTTPClient.SimpleGet(baseUrl);
// Find all book urls
re := TRegExpr.Create('<a href="([\w]+)/"');
try
if re.Exec(page) then begin
bookname := re.Match[1];
downloadBook(bookname);
while re.ExecNext do begin
bookname := re.Match[1];
downloadBook(bookname);
Application.ProcessMessages;
end;
end;
Memo1.Append('');
Memo1.Append('All books downloaded');
finally
re.Free;
end;
end;
procedure TForm1.downloadBook(bookname: String);
var
page: AnsiString;
re: TRegExpr;
begin
// Get page
page := TFPHTTPClient.SimpleGet(baseUrl + bookname + '/index.html');
// Grab PDF url
re := TRegExpr.Create('location.href=''([\w]+.pdf)''');
try
if re.Exec(page) then begin
Memo1.Append('Downloading ' + baseUrl + bookname + '/' + re.Match[1]);
TFPHTTPClient.SimpleGet(baseUrl + bookname + '/' + re.Match[1], targetDirectory + re.Match[1]);
end;
finally
re.Free;
end;
end;
end.

Saturday, October 13, 2018

Zaboravili ste WiFi lozinku, nema problema - za korisnike M$ Window$ 7,8,10

1 .startujte cmd.exe kao administrator i otkucajte ovo:
netsh wlan show profile

2. Kada ste saznali koja su sve imena za WiFi dostupna, kucaj ovo:
netsh wlan show profile WiFi-ime key=clear

Ovde je WiFi-ime ime tvog WiFi-ja za koji ti treba lozinka.

Dakle, prva naredba lista sva IMENA WIFI UREDJAJA, a druga naredba lista izmedju ostalog i LOZINKU koja te zanima.

Ako je nekome ovo pomoglo dajte mi neku pohvalu u komentar.



Friday, April 28, 2017

Elegantno merenje vremena izvrsenja PHP procedura

http://php.net/manual/en/function.microtime.php


ou can use microtime and calculate the difference:
$time_pre = microtime(true);
exec(...);
$time_post = microtime(true);
$exec_time = $time_post - $time_pre;


http://stackoverflow.com/questions/8310487/start-and-stop-a-timer-php

Koja je brzina tvog servera ? PHP

Koja je brzina tvog servera ?

<?phpif (isset($_GET['source']))
{
    
highlight_file($_SERVER['SCRIPT_FILENAME']);
    exit;
}
$maxNumKB 4096;$defNumKB 512;
if (!isset(
$_GET['numKB']) || intval($_GET['numKB']) > $maxNumKB)
{
    
header("Location: http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}?numKB=$defNumKB");
    exit;
}
$numKB intval($_GET['numKB']);?><!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Jan! &raquo; PHP &raquo; speed test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">
    <!--
    html
    {
        font-family: sans-serif;
        color: #000;
        background: #fff;
    }
    *
    {
        font-size: medium;
    }
    #wait
    {
        border-bottom: thin dotted black;
    }
    #wait abbr
    {
        border: none;
    }
    #done
    {
        font-weight: bold;
    }
    #benchmark
    {
        padding: 1em;
        border: 1px solid black;
        background: #ffe;
        color: #000;
    }
    //-->
    </style>
</head>
<body>
<div id="benchmark">
<p>
    <strong>This not a script to benchmark or determine the execution speed
    of PHP scripts.</strong> If you're looking for one, check out the PEAR
    <a href="http://pear.php.net/package/Benchmark">Benchmark package</a>.
</p>
<p>
    This script sends <?php echo $numKB?> <abbr title="kilobyte">KB</abbr>
    of HTML comments to your client. Parsing that HTML may add to the total
    transfer time, so don't take this as your raw download speed.
</p>
</div>
<h1>Please wait</h1>
<p>
    <a href="<?php echo "http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}?source=1"?>">(Show source)</a>
</p>
<p id="wait">
    Transferring <?php echo $numKB?> <abbr title="kilobyte">KB</abbr>
</p>
<!--
<?phpfunction getmicrotime()
{
    list(
$usec$sec) = explode(" "microtime());
    return ((float)
$usec + (float)$sec);
}
flush();$timeStart getmicrotime();$nlLength strlen("\n");
for (
$i 0$i $numKB$i++)
{
    echo 
str_pad(''1024 $nlLength'/*\\*') . "\n";
    
flush();
}
$timeEnd getmicrotime();$timeDiff round($timeEnd $timeStart3);?>-->
<p id="done">
    <?php
        
echo "Transferred {$numKB} <abbr title=\"kilobyte\">KB</abbr> in {$timeDiff} seconds, " .
             (
$timeDiff <= "more than {$numKB}round($numKB $timeDiff3)) .
             
' <abbr title="kilobytes per second">KB/s</abbr>';
    
?></p>
</body>
</html>