$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "GOOGLE"); // Обманочка
curl_setopt($ch, CURLOPT_HEADER, 0);
$output = curl_exec($ch);
echo '<pre>';
print_r( curl_getinfo($ch) );
echo '</pre>';
curl_close($ch);
echo $output;
Array
(
[url] => https://soccer365.ru/games/921770/
[content_type] => text/html; charset=UTF-8
[http_code] => 301
[header_size] => 539
[request_size] => 84
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0.255368
[namelookup_time] => 0.000614
[connect_time] => 0.02999
[pretransfer_time] => 0.19802
[size_upload] => 0
[size_download] => 0
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => 0
[upload_content_length] => 0
[starttransfer_time] => 0.25531
[redirect_time] => 0
[redirect_url] => https://soccer365.ru//soccer365.ru/live/match-etyir-1924-levski-smotret-onlayn/
[primary_ip] => 51.15.25.134
[certinfo] => Array
(
)
)
margin-top: 0.2em;
. А в DESKTOP версии просто разрешение экрана слишком мало чтобы увидеть, что текст тоже немного выше центра кнопки.font-variant-caps: all-small-caps;
, а они уже будут хоть и маленькие но по середине.<?php
//define('STDOUT', fopen('debug_log.txt', 'wb')); //write console logs to file
use JonnyW\PhantomJs\Client;
$url = 'https://toster.ru';
$client = Client::getInstance();
//$client->getEngine()->debug(true); //enable debug
$request = $client->getMessageFactory()->createCaptureRequest($url);
$response = $client->getMessageFactory()->createResponse();
$request->setOutputFile( 'preview.png' );
$request->setViewportSize(500, 1500); //width, height
//$request->setCaptureDimensions(500, 645, 0, 0); //width, height, top, left
$request->setFormat('png');
$request->setQuality(100);
$request->setTimeout(5000); // will render page if this timeout is reached and resources haven't finished loading
$client->send($request, $response);
$image = imagecreatefrompng( 'preview.png' );
$image = imagecropauto( $image, IMG_CROP_WHITE );
imagepng( $image, 'croped_preview.png' );
imagedestroy( $image );
from selenium import webdriver
driver = webdriver.Chrome('/usr/local/bin/chromedriver')
driver.set_window_position(0, 0)
driver.set_window_size(500, 1500)
driver.get('https://toster.ru')
screenshot = driver.save_screenshot('/users/Pavel/Desktop/preview.png')
convert template_bolts.png +level-colors #FF0000, ready_bolts.png
convert -append ready_*.png final_image.png
function add_new_topic( $new_status, $old_status, $post ) {
if ( $new_status === 'publish' && $old_status !== 'publish' ) {
...
}
}
add_action( 'transition_post_status', 'add_new_topic', 10, 3 );
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
import ssl
try:
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
pass
else:
ssl._create_default_https_context = _create_unverified_https_context
$arrXcount = count($arrX);
$arrYcount = count($arrY);
for ($a = 0; $a < $iter; $a++) {
for ($i = 0; $i < $arrXcount; $i++) {
for ($j = 0; $j < $arrYcount; $j++) {
...
}
}
}
if ($value % 2 == 0) {
$total = $total + 1;
}
if ($value % 2 != 0) {
$total = $total + 2;
}
if ($value % 2 == 0) {
$total = $total + 1;
} else {
$total = $total + 2;
}
echo "Total: $total";
echo "<br>Script time is $time";
echo 'Total: ' . $total;
echo '<br>Script time is ' . $time;
$fn__get_thumb_id_from_text = function( $text ){
global $post;
$meta_social_image = get_post_meta($post->ID, 'meta_social_image', true);
if ( $meta_social_image ) {
return $meta_social_image; // Всё, картинка есть, заканчиваем
}
if( preg_match( '/<img +src *= *[\'"]([^\'"]+)[\'"]/', $text, $mm ) &&
( $mm[1]{0} === '/' || strpos($mm[1], $_SERVER['HTTP_HOST']) ) ){
$name = basename( $mm[1] );
$name = preg_replace('~-[0-9]+x[0-9]+(?=\..{2,6})~', '', $name ); // удалим размер (-80x80)
$name = preg_replace('~\.[^.]+$~', '', $name ); // удалим расширение
$name = sanitize_title( sanitize_file_name( $name ) ); // приведем к стандартному виду
global $wpdb;
$thumb_id = $wpdb->get_var(
$wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_type = 'attachment'", $name )
);
} else {
$zm_social_image = get_theme_mod('zm_social_image');
$thumb_id = $zm_social_image;
}
return empty($thumb_id) ? 0 : $thumb_id;
};
<form action="post_create.php" method="post" enctype="multipart/form-data">
<input type="text" name="title">
<input type="text" name="tags">
<input type="text" name="text">
<input type="file" name="pic">
<input type="submit" name="submit" value="Submit">
</form>
define( 'WP_DEBUG', true );
add_shortcode( 'clinic', 'call_shortcode_clinic' );
function call_shortcode_clinic( $atts ) {
ob_start();
$atts = shortcode_atts( array( 'id' => null ), $atts );
$clinic_query = new WP_Query( array(
'post_type' => 'clinics',
'p' => intval( $atts['id'] )
));
echo '<div class="clinic">';
if ( $clinic_query->have_posts() ) :
while ( $clinic_query->have_posts() ) : $clinic_query->the_post();
get_template_part( 'template-parts/clinic', get_post_format() );
endwhile;
else :
get_template_part( 'template-parts/content', 'none' );
endif;
echo '</div>';
wp_reset_postdata();
return ob_get_clean();
}
add_shortcode( 'doctor', 'call_shortcode_doctor' );
function call_shortcode_doctor( $atts ) {
ob_start();
$atts = shortcode_atts( array( 'id' => null ), $atts );
$doctor_query = new WP_Query( array(
'post_type' => 'doctors',
'p' => intval( $atts['id'] )
));
echo '<div class="doctor">';
if ( $doctor_query->have_posts() ) :
while ( $doctor_query->have_posts() ) : $doctor_query->the_post();
get_template_part( 'template-parts/doctor', get_post_format() );
endwhile;
else :
get_template_part( 'template-parts/content', 'none' );
endif;
echo '</div>';
wp_reset_postdata();
return ob_get_clean();
}
$extracted_plaintext = mb_convert_encoding( $extracted_plaintext, 'UTF-8', 'UTF-16LE' );
function read_doc_file($filename) {
if (file_exists($filename)) {
if (($fh = fopen($filename, 'r')) !== false) {
$headers = fread($fh, 0xA00);
// 1 = (ord(n)*1) ; Document has from 0 to 255 characters
$n1 = ( ord($headers[0x21C]) - 1 );
// 1 = ((ord(n)-8)*256) ; Document has from 256 to 63743 characters
$n2 = ( ( ord($headers[0x21D]) - 8 ) * 256 );
// 1 = ((ord(n)*256)*256) ; Document has from 63744 to 16775423 characters
$n3 = ( ( ord($headers[0x21E]) * 256 ) * 256 );
// 1 = (((ord(n)*256)*256)*256) ; Document has from 16775424 to 4294965504 characters
$n4 = ( ( ( ord($headers[0x21F]) * 256 ) * 256 ) * 256 );
// Total length of text in the document
$textLength = ($n1 + $n2 + $n3 + $n4);
$extracted_plaintext = fread($fh, $textLength);
$extracted_plaintext = mb_convert_encoding( $extracted_plaintext, 'UTF-8', 'UTF-16LE' );
return nl2br($extracted_plaintext);
} else {
return FALSE;
}
} else {
return FALSE;
}
}
$text = read_doc_file('test.doc');
$text = "A strange string ø, æ, å, ж, п, ą, ū, ė, …";
foreach(mb_list_encodings() as $chr){
echo mb_convert_encoding( $text, 'UTF-8', $chr ) . " : " . $chr . "<br><br>";
}