1. Go to this page and download the library: Download lookinsite/lookin-sdk-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lookinsite / lookin-sdk-php example snippets
et("display_errors", "On");
use Lookin\Services\Search\SearchClient;
use Lookin\Services\Search\SearchRequest;
try {
// initiate client
$client = new SearchClient("sk_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
// build request
$req = new SearchRequest([
"q" => "keyword",
"device" => "desktop", // or mobile
"size" => 40, // optional
"page" => 1, // optional
]);
// send search request
$res = $client->search($req);
$str = 'Page %d of %d, showing %d records out of %d total, starting on record %d, ending on %d<br>';
echo sprintf($str, $res->current_page, $res->total_pages, $res->size, $res->total, $res->start, $res->end);
foreach ($res->getIterator() as $hit) {
echo $hit->title . "<br>";
echo $hit->url . "<br>";
echo $hit->score . "<br>";
echo $hit->content;
echo '<hr>';
}
} catch (\Exception $ex) {
echo $ex->getMessage();
}
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.