javascript – How to use PhantomJS from PHP?

I need to create a feature that returns the last redirection in a set of redirects. To do this, I have a PHP function, however, this does not work for those URLs whose referrals are made from JS, because PHP does not run JS.

It was recommended that I use a browser without a head, so I downloaded and installed PhantomJS. In addition, I ran the basic examples of the documentation and it works perfectly.

Because PhantomJS is executed in the command line, invoking it from PHP would be enough to simply add the following line to the script

exec (# / usr / local / bin / phantomjs path / somescript.js & # 39;)

Now well, What should I do to receive the response from phantomjs?

What settings do I need to set to return the last URL?

How to integrate the Bitcoin payment system. Split a payment address into multiple addresses using codeigniter in php?

I want to implement the Bitcoin payment system on my website, where I buy a bitcoin song and songs. Payment in bitcoin purchase time divided into an address at multiple addresses with a different amount in a single transaction, how can I proceed?

Help me, please
Thank you in advance.

See more in Váriavel PHP

Galera, I have a list of products, in the description, I wanted to set a limit, for example: when the text exceeds a limit of characters, it appears 3 points on which to click, and all the text s & # 39; displayed.

List of products

The description comes from the echo in the variable

PHP variable

settings.php – Get the PHP extension "gd" and the error disabled database support during the installation of Drupal 8

I'm trying to install Drupal 8.7.3 on my Windows machine via Xampp (PHP 7.3.6). But I receive the following errors:

Please see the screen capture:
https://snag.gy/06sMEa.jpg

I tried to do the following but I could not solve it:

1- I've copied php.ini to the root of my drupal folder and made sure the extensions are enabled. and I made sure that the default php.ini has the same extensions enabled.
Please see the screenshot: https://snag.gy/nN8BGA.jpg

2- I have also downloaded the php_gd2.dll and php_gd.dll files and have them also placed in the / ext folder. please see the screenshot: https://snag.gy/RHqrlI.jpg

My problem remains the same. Can you help me solve this problem.

Here is my result phpinfo () on the extensions:
https://snag.gy/ifsIjo.jpg

See also the path of the extension:
https://snag.gy/Jlcw01.jpg

php – How can I solve the problem of htaccess making social robots see the answer 404 even if the page displays correctly?

I'm using the htaccess code below that seems to work correctly to rewrite the URLs. However, when a page is shared on social networks or scanned by bots such as AHREF, they all return 404 and yet the pages of the site display correctly, and when I print http_response_code () on one page, the answer value is 200.





RewriteEngine on

#RewriteBase /

RewriteCond% {REQUEST_FILENAME} -d
RewriteRule ^ (. +[^/]) $ 1 / [R]

RewriteCond% {REQUEST_FILENAME}! -F
RewriteCond% {REQUEST_FILENAME}! -D

RewriteCond $ 0 #% {REQUEST_URI} ([^#]*) # (. *)  1 $
RewriteRule ^. * $% 2index.php [QSA,L]

The long URL being rewritten

index.php? component = publications & view = post & category = 15-blog & post = 31-comment-blog-well & menuid = 25-blog

The rewritten URL

/ the-blog / how-blog-well

PHP functions that process URLs

/ *
Process URLs as sent from links, before converting them to SEF
recover $ _GET[] values ​​to use in database queries and
other instructions
* /

getNonSEF () function
{
$ path = pathinfo (currenturl ());
$ filename = $ path['filename'];
$ dirnames = explode (& # 39; / #, $ path['dirname'])
preg_match (#[^/]+ $ # i, $ path['dirname'], $ match);


// product detail and message display
if ($ path['dirname']. & # 39; / & # 39; == ROOT_URL)
{
$ postid = posts () -> where (& quot; alias & quot ;, getCurrentFilename ()) -> value (& # 39; id & # 39;);
$ cat_id = categories () -> where (& quot; alias & quot ;, getCurrentFilename ()) -> value (& # 39; id;);

$ groupval = getDbo (& # 39; mod_cmse_products & # 39;) -> select (& # 39; group_id & # 39; group_alias & # 39;) -> where (& # 39; group_alias & # 39 ;, $ filename) -> get ()[0];

if (! empty ($ postid)) {
$ queryurl = parse_url (menus () -> where ([['type', 3], ['src_id', $postid]]) -> value (& # 39; url & # 39;))['query'];
}other
if (! empty ($ cat_id)) {
$ url = menus () -> where ([['src_id', $cat_id], ['type', 2]]) -> value (& # 39; url & # 39;);
if (! empty ($ url)) {
$ queryurl = parse_url ($ url)['query'];
}other{
// the category has no menu item
$ queryurl = & # 39; component = posts & view = category & category = & # 39; $ ID_Cat. & # 39; - & # 39 ;. getCurrentFilename ();
}
}other
// product category
if ($ filename == $ groupval-> group_alias) {
$ queryurl = <component = products & view = productgroup & gid = & # 39; $ groupval-> group_id. - - #. $ groupval-> group_alias;
//}other
//index.php?component=products&view=productgroups&menuid=25-all-services
// if (in_array ($ filename, menus () -> where (& # 39; type, 5) -> pluck (& ​​quot; alias & quot;)))) {
// $ queryurl = parse_url (menus () -> where (& quot; alias & quot ;, getCurrentFilename ()) -> value (& quot; url & quot;)['query'];
}other{
$ queryurl = parse_url (menus () -> where (& quot; alias & quot ;, getCurrentFilename ()) -> value (& quot; url & quot;)['query'];
}

}other

{
// if the view is posted and has a category alias in the URL but has no menu assigned
$ postval = posts () -> select ('id', 'catid', 'alias') -> where (& # 39; $ filename) -> get ()[0];

$ prodval = getDbo (& # 39; mod_cmse_products & # 39;)
-> select (& # 39; prod_alias & # 39 ;, & # 39; prod_id & # 39 ;, & # 39; prod_gid & # 39;)
-> where (& # 39; prod_alias & # 39 ;, $ filename)
-> get ()[0];

if ($ filename == $ postval-> alias) {
$ posturl = menus () -> select ('id', 'url', 'src_id') -> where ([['src_id', $postval->catid],['type', 2]]) -> get ()[0];
parse_str (parse_url ($ posturl-> url)['query']$ urlparts);

$ queryurl = & # 39; component = & # 39; $ urlparts['component']. & # 39; & view = post & category = & # 39; $ urlparts['category']. & # 39; & post = & # 39 ;. $ postval-> id. - #. $ way['filename']. & # 39; & menuid = & # 39; $ urlparts['menuid'];
}other

// component is a product
if ($ filename == $ prodval-> prod_alias) {
$ prodgroup = getDbo (& # 39; mod_cmse_products & # 39;) -> where (& # 39; group_id & # 39 ;, prodval-> prod_gid) -> value (& # 39; group_alias & # 39;);
$ queryurl = <component = products & view = productdetail & gid = & # 39; $ prodval-> prod_gid. & # 39; - & # 39; $ prodgroup. & # 39; & pid = & # 39; $ prodval-> prod_id. & # 39; - & # 39; $ prodval-> prod_alias;
}

}


$ queryurl = html_entity_decode ($ queryurl);


// retrieve the elements of the query
$ view = getInput ($ queryurl, & view;
$ category = getInput ($ queryurl, & # 39; category);
$ post = getInput ($ queryurl, & # 39; post);
$ menuid = str_replace (- ',', (int) getInput ($ queryurl, 'menuid');
$ listpage = getInput ($ queryurl, & # 39; listpage & # 39;)
$ prodid = getInput ($ queryurl, & ppp;);
$ groupid = getInput ($ queryurl, & gid; gid & # 39;)
$ parent = $ match[0];

// registered components
$ com_posts = ['post', 'category', 'categories'];
$ com_product = ['productdetail', 'productgroup', 'productgroups'];

// the decision maker (roger)
if (in_array ($ view, $ com_product)) {
$ component = "products";
}other
if (in_array ($ view, $ com_posts)) {
$ component = & # 39; posts & # 39 ;;
}

$ list = [$component, $view, $category, $post, $menuid, $listpage, $prodid, $groupid, $parent];

return $ list;
}


/ *
router that encapsulates the URL in the files
for example: <a href = "catid. - & # 39 ;. $ cat-> alias. & # 39; & post = & # 39; $ post-> id. & # 39; & # 39; & # 39; $ post-> alias. & # 39; & menuid = & # 39; $ menuid); ?> "> See the message
* /

function router ($ url)
{
$ shares = parse_url (ROOT_URL. $ url);
parse_str ($ shares['query']$ q);

$ component = $ q['component'];
$ view = $ q['view'];
$ category = $ q['category'];
$ post = $ q['post'];
$ menuid = $ q['menuid'];
$ prodgroup = $ q['gid'];
$ prodid = $ q['pid'];


if (isset ($ component))
{
if ($ view == & post; && isset ($ post) &&! isset ($ category) && isset ($ menuid)) {
$ num = (int) $ post;
$ route = str_replace ($ num. - & # 39;, #,; post);
}other
// publications without a menu ID use a category alias in the URL
if ($ view == & post; && isset ($ post) && isset ($ category)) {
$ num = (int) $ post;
$ nums = (int) $ category;
$ route = str_replace ($ nums. - #, & # 39;, # category). & # 39; / & # 39 ;. str_replace ($ num. - #, & # 39;, # post);
}other
// show the category
if ($ view == & # 39; && isset ($ category)) {
$ num = (int) $ category;
$ route = str_replace ($ num. - & # 39;, #,; category);
}other
if ($ view == & # 39; categories & # 39;) {
$ num = (int) $ menuid;
$ route = str_replace ($ num. - -, #,; $ menuid);
}other

// detailed product view
if ($ view == & # 39; productdetail && isset ($ prodgroup) && isset ($ prodid)) {
$ route = preg_replace (#  d +  - #, & # 39; & # 39;, strtolower ($ prodgroup)). & # 39; / & # 39 ;. preg_replace (#  d +  - # & # 39 ;, $ prodid);
}other

if (isset ($ view) && $ view == & # 39; productgroup && isset ($ prodgroup)) {
$ num = (int) $ prodgroup;
$ route = str_replace ($ num. - -, & # 39;, $ prodgroup);
}other
if (isset ($ view) && $ view == & # 39; productgroups & # 39;) {
$ num = (int) $ menuid;
$ route = str_replace ($ num. - -, #,; $ menuid);

if (pathinfo (currenturl ())['filename'] == & # 39; cart & # 39; &&! requestKey (& # 39;)) {
redirect (str_replace ($ num. - & # 39;, # menuid), 301);
}
}

}other{
// default URL
$ route = $ url;
}

return $ route;
}

What's odd is when I use Facebook's object debugger to scratch the pages, although the 404 report, the og: image, is returned and when I click on "see what the scraper sees" , the HTML code is correct! The bot sees the good HTML code, but reports "an incorrect response code".

I've tried adding the following condition to tell the bots to use the given URL, but it does not work.

RewriteCond% {HTTP_USER_AGENT} (facebookexternalhit /[0-9]| Twitterbot | Pinterest | Google. * Extract)
RewriteRule. * [L]

This is the type of URL that fails with 404 and sometimes 500, only seen by the bots http://websitedons.net/demo/whmcs/the-blog

But this URL returns 200 http://websitedons.net/demo/whmcs

How does one write htaccess to consistently provide good answers?

Save a php file with emojis

When I replace an HTML emoji with its code and try to save the page:

$ text = preg_replace ("/
2.gif
/ "," & # 128515; ", $ text);

I get a message saying: "Some items may not be registered correctly because you have windows-1251 encoding elements, etc."

If I continue and save the page, the code after the preg_replace is cut off and the emoji
2.gif
looks like crazy code.
SEMrush

Is there a way to save a php page containing HTML emojis?

php – Data is not displayed in the Laravel 5.8 form field

In the create.blade view, I have a field in which the data must be displayed to be selected and not displayed. This data has already been entered in another section of the corresponding database table.

The other fields display the data correctly but in Surplus, they do not appear. In addition, the Surplus field is connected to the stock because they come from the same table in the database, that is, when a surplus is selected, the inventory of the surplus must be automatically loaded. obviously I could not check it because of the problem described above.

Here I leave a picture:

enter the description of the image here
Here, I leave the create function of the controller:

public function create ()
{

$ surplus = DB :: table ('surplus' as ex)
-> join (& # 39; detailrea as drea & # 39; ex.idexcedente, & # 39; = & # 39 ;, & dquo; drea.idexcedente & # 39;)
-> join (& # 39; provider_secure as pre & # 39; address_ender & # 39; = & # 39 ;, & # 39; pre.ender & # 39;)
-> select (ex.idexcedente, "ex.number", ex.stock, & # 39; pre.number & quot;)
-> where (& # 39; ex.condicion), & # 39; = & # 39;, & # 39; 1 & # 39;)
-> where (ex.stock, & # 39;> & # 39;, & # 39; 0 & # 39;)
-> get ();

$ patientsm = DB :: table (& # 39; pmedicamentos & # 39;) -> get ();

$ lender = DB :: table (& # 39; lender_secure & # 39;) -> get ();

$ request_type = DB :: table (& # 39; request_type) -> get ();

return the view ("reaffectations.create", [
            "excedentes"=>$excedentes,
            "pacientesm"=>$pacientesm,
            "prestador"=>$prestador,
            "tiposolicitud"=>$tiposolicitud

        ])
}

And here is the field corresponding to surplus in the create.blade view:

envoi_processus.php



                
Me:

I found this excerpt using the websocket, I tried to implement it in mine, but it did not work.

application.js

php – How to display an image on the woocommerce product page?

I already have written code but I did not know how can link my image to this

listify_cover function ($ class, $ args = array ()) {
$ defaults = apply_filters (
& # 39; & # 39 ;, listify_cover_defaults
board (
& # 39; image & # 39; => false,
& # 39; object_ids & # 39; => false,
& # 39; size & # 39; => & # 39 ;,
)
)
$ args = wp_parse_args ($ args, $ defaults);
$ image = false;
$ atts = array ();

global $ wp_query;

$ post = get_post ();

if ((function_exists (& # 39; is_shop & # 39;) && is_shop ()) || is_singular (& nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp;
$ image = wp_get_attachment_image_src (get_post_thumbnail_id (wc_get_page_id (shop #); $ args['size'] )
} elseif (is_tax (array (& # 39; product_cat & # 39; product_tag & # 39;)))) // // WooCommerce archive.
$ thumbnail_id = get_woocommerce_term_meta (get_queried_object_id (), & # 39; thumbnail_id & # 39 ;, true);
$ image = wp_get_attachment_image_src ($ thumbnail_id, $ args['size'] )
} elseif ((is_home () &&! in_the_loop ())) {// Blog.
$ image = wp_get_attachment_image_src (get_post_thumbnail_id (get_option (page_for_posts))), $ args['size'] )
} elseif (! in_the_loop () && is_singular (& # 39;)) {// blog post.
$ image = array (get_the_post_thumbnail_url (get_post (), $ args['size'] ));
} elseif ((! did_action (& # 39; loop_start & # 39;) && is_archive ()) || ($ args['images'] || $ args['object_ids'] )) {// Blog archive.
$ image = listify_get_cover_from_group ($ args);
} elseif (is_a ($ post, WP_Post)) {// Unique.
if (& # 39 ;! == $ post -> _ thumbnail_id) {
$ image = wp_get_attachment_image_src (get_post_thumbnail_id (), $ args['size'] )
} elseif (apply_filters (& # 39; listify_listing_cover_use_gallery_images & # 39 ;, false) && listify_has_integration (& # 39; wp-job-manager & # 39;)) {
$ gallery = Listify_WP_Job_Manager_Gallery :: get ($ post-> ID);

if ($ gallery) {
$ args['images']    = $ gallery;
$ args['post_type'] = & # 39; job_listing & # 39 ;;

unset ($ args['object_ids'] )

$ image = listify_get_cover_from_group ($ args);
}
}
}

$ image = apply_filters (& # 39; listify_cover_image & # 39 ;, image, $ args);

if (! $ image) {
$ class. = No-picture;

return sprintf ("class ="% s ", $ class);
}

$ class. = & # 39; has-image & # 39 ;;

$ atts[] = sprintf (style = "background image: url (% s);", $ image[0] )
$ atts[] = sprintf ("class ="% s ", $ class);

return implode (& # 39 ;, $ atts);

}
add_filter (& # 39; listify_cover & # 39 ;, & quot; listify_cover & # 39 ;, 10,2);

in the model I have:

<div >

Div with his class arrives but without picture:
enter the description of the image here
Any help would be appreciated. Thank you