94 lines
2.3 KiB
PHP
94 lines
2.3 KiB
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: eric
|
|
* Date: 12/23/16
|
|
* Time: 4:19 PM
|
|
*/
|
|
|
|
require __DIR__ . '/vendor/autoload.php';
|
|
/*
|
|
if(false === is_dir(__DIR__ . '/images'))
|
|
{
|
|
mkdir(__DIR__ . '/images');
|
|
}
|
|
*/
|
|
|
|
$client = new \Sikofitt\Tor\TorClient();
|
|
|
|
$resource = \GuzzleHttp\Psr7\StreamWrapper::getResource(new \GuzzleHttp\Psr7\Stream(fopen('http://4sy6ebszykvcv2n6.onion/', 'rb')));
|
|
|
|
/*$client->get('http://32b5oz2bbtn6gqj3.onion/index.php/Main_Page');
|
|
|
|
$images = $client->images();
|
|
$iterator = $images->getIterator();
|
|
while($iterator->valid()) {
|
|
/*
|
|
* $iterator->current(); is an array of
|
|
* $result['fqd'] fully qualified domain uri - example.onion/path/filename.image
|
|
* $result['src'] = the image src element, could be fqd or just /path/filename.image
|
|
* $result['raw'] = the raw image data
|
|
* $result['base64'] = base64 encoded raw data - file_put_contents(base64_decode(base64), file.image);
|
|
* $result['html'] = the html of the page the image was retrieved from.
|
|
*/
|
|
/* foreach($iterator->current() as $key => $value)
|
|
{
|
|
file_put_contents(__DIR__ . '/images/' .
|
|
pathinfo($value['src'], PATHINFO_FILENAME) . '.' .
|
|
pathinfo($value['src'], PATHINFO_EXTENSION),
|
|
$value['raw']);
|
|
}
|
|
$iterator->next();
|
|
}
|
|
|
|
*/
|
|
|
|
/*$client->get('http://4sy6ebszykvcv2n6.onion/');
|
|
$images = $client->images();
|
|
$html = $client->getHtml();
|
|
dump($html);
|
|
*/
|
|
//dump($resource);
|
|
|
|
|
|
$j = stream_get_contents($resource);
|
|
|
|
|
|
fclose($resource);
|
|
dump($j);
|
|
|
|
|
|
|
|
/*
|
|
$iterator = $images->getIterator();
|
|
while($iterator->valid()) {
|
|
foreach($iterator->current() as $key => $value)
|
|
{
|
|
file_put_contents(__DIR__ . '/images/' .
|
|
pathinfo($value['src'], PATHINFO_FILENAME) . '.' .
|
|
pathinfo($value['src'], PATHINFO_EXTENSION),
|
|
$value['raw']);
|
|
}
|
|
$iterator->next();
|
|
}
|
|
|
|
$testArray = [
|
|
'fqd' => null,
|
|
'src' => null,
|
|
'alt' => null,
|
|
'base64' => null,
|
|
'html' => null
|
|
];
|
|
$image = new \Sikofitt\Element\Image('https://www.google.com/file/robots.txt', $testArray);
|
|
dump($image);
|
|
//$images = $client->images();
|
|
//dump($images);
|
|
//$client->get('https://de.indymedia.org/index.shtml');
|
|
//foreach($images as $image) {
|
|
//$image = new \Doctrine\Common\Collections\ArrayCollection();
|
|
|
|
// dump($image);
|
|
//}
|
|
//dump($result);
|
|
|
|
*/ |