<?php
$xml = <<<XML
<CurrencyRates Name="Daily Exchange Rates" Date="13.01.2016">
<Currency ISOCode="USD">
<Nominal>1</Nominal>
<Value>75,8985</Value>
</Currency>
<Currency ISOCode="EUR">
<Nominal>1</Nominal>
<Value>82,6117</Value>
</Currency>
</CurrencyRates>
XML;
$xml = simplexml_load_string($xml);
echo $xml['Date'];
foreach ($xml->Currency as $Currency) {
$number = $Currency->Value;
echo '<span class="cur-code">' . $Currency['ISOCode'] . '</span>';
echo '<span class="cur-val">' . sprintf('%.02f', str_replace(',', '.', $number)) . '</span>';
}
<?php
$phrase = 'secret message';
$key = 'KEY';
$encrypt = encrypt($key, $phrase);
$phrase = decrypt($key, $encrypt);
echo $encrypt, ' = ', $phrase;
function encrypt($key, $text) {
$cipher = mcrypt_module_open(MCRYPT_BLOWFISH,'','cbc','');
mcrypt_generic_init($cipher, $key, '12345678');
$encrypted = mcrypt_generic($cipher,$text);
mcrypt_generic_deinit($cipher);
$encrypted = bin2hex($encrypted);
return $encrypted;
}
function decrypt($key, $encrypted) {
$encrypted = hex2bin($encrypted);
$cipher = mcrypt_module_open(MCRYPT_BLOWFISH,'','cbc','');
mcrypt_generic_init($cipher, $key, '12345678');
$decrypted = mdecrypt_generic($cipher,$encrypted);
mcrypt_generic_deinit($cipher);
return $decrypted;
}
select * from tbl where id in(1,2,3) order by field(id, 1, 2, 3)
{
"require": {
"jonnyw/php-phantomjs": "3.*",
"symfony/dom-crawler": "3.*",
"symfony/css-selector": "3.*"
},
"config": {
"bin-dir": "bin"
},
"scripts": {
"post-install-cmd": [
"PhantomInstaller\\Installer::installPhantomJS"
],
"post-update-cmd": [
"PhantomInstaller\\Installer::installPhantomJS"
]
}
}
php composer.phar install
<?php
require __DIR__ . '/vendor/autoload.php';
$client = \JonnyW\PhantomJs\Client::getInstance();
$request = $client->getMessageFactory()->createRequest('http://superdeals.aliexpress.com/en?spm=2114.11010108.21.1.v65LIL', 'GET');
$response = $client->getMessageFactory()->createResponse();
$client->send($request, $response);
$html = $response->getContent();
$crawler = new \Symfony\Component\DomCrawler\Crawler($html);
$div = $crawler->filter('div.pro-msg');
if($div) {
echo $div->first()->text();
}
/usr/local/bin/php /Users/evgenij/projects/untitled/index.php
Today Only
Boy's Coat
> Synthetic leather> Motor jacket style> Available in black and red
share:
vk
pinterest
facebook
Twinner
Google+
Email
Sign in and share the website for a chance to get Points, which you can then convert to coupons.
US $9.74
US $32.48 / piece | 70% Off
0486Left
Buy Now
Process finished with exit code 0
<a href="/admin/page_editor">Настройка страниц</a>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>http://site.com/sitemap/part1.xml</loc>
</sitemap>
<sitemap>
<loc>http://site.com/sitemap/part2.xml</loc>
</sitemap>
</sitemapindex>