October 22, 2024
Chicago 12, Melborne City, USA
PHP

PHP file_get_contents, get result

How can i get just "ticket" ? <?php $data = json_decode(file_get_contents('dlticket.json') , true); echo 'HTML ' . $data['msg'] . ' HTML '; ?> {"status":100,"msg":"OK","result":{"ticket":"I.want.this.value","wait_time":10,"valid_until":"2024"}} You need to sign in to view this answers

Read More
PHP

Why I get fatal error when trying to run composer update in empty laravel project?

I am created new laravel project, ran composer update and get this error: > @php artisan package:discover Fatal error: Uncaught Error: Call to undefined method Composer\Repository\PlatformRepository::isPlatformPackage() in /var/www/app/vendor/composer/composer/src/Composer/Json/JsonManipulator.php:139 Stack trace: #0 /var/www/app/vendor/composer/composer/src/Composer/Json/JsonManipulator.php(163): Composer\Json\JsonManipulator->Composer\Json\{closure}('php') #1 [internal function]: Composer\Json\JsonManipulator->Composer\Json\{closure}('php', 'matviib/telegra...') #2 /var/www/app/vendor/composer/composer/src/Composer/Json/JsonManipulator.php(164): uksort(Array, Object(Closure)) #3 /var/www/app/vendor/composer/composer/src/Composer/Json/JsonManipulator.php(119): Composer\Json\JsonManipulator->sortPackages(Array) #4 /var/www/app/vendor/php-http/discovery/src/Composer/Plugin.php(445): Composer\Json\JsonManipulator->addLink('require', 'php-http/messag...', '*', true) #5 /var/www/app/vendor/php-http/discovery/src/Composer/Plugin.php(176): Http\Discovery\Composer\Plugin->updateComposerJson(Array, true)

Read More
PHP

Rust “hello world” script not running via ajax calls, but is via curl in the server itself

I have a PHP web application using Apache. I’m trying to add the ability to run Rust scripts. I can get it to work on localhost via: fetch('/rust/hello') // Proxy through Apache (no need for port in URL) .then(response => response.text()) .then(data => { console.log(data); // Should log "Hello, world!" }) .catch(error => console.error('Error:', error));

Read More
PHP

Cannot send email with `symfony/mailer`, but native function `mail` works

I have a server configured with DKIM and the native mail function seems to respect that and sends out emails without a problem. However, I need to use symfony/mailer (wrapped by yiisoft/yii2-symfonymailer) and I cannot get it to work. If I use the default SmtpTransport, I get the following error: 550-Verification failed for <XXXX> 550-Unrouteable

Read More
PHP

Maximum Execution Time Question “Maximum execution time of 60 seconds exceeded”

I’m interested in getting more insight into how the Maximum Execution time on PHP/Laravel works. I tried to google it myself, but wasn’t sucessful. Here is the problem. I wrote a piece of code in Laravel that gets data from a API, extract wanted data from the response and then saves it to the database.

Read More
PHP

Error with upload MySQL database to xampp

When I try to add .sql file of an already made PHP script I wasn’t the developer, it says: Error ----------------------- Database: Jack #1050: A table "admins" already exists. Any Solutions on how I can solve the issue? You need to sign in to view this answers

Read More
PHP

Why is my WHMCS hook not creating a ticket?

I am trying to create a ticket when a domain registration or transfer fails. Right now I’m just working on the registration failure. Here is my code: <?php add_hook('AfterRegistrarRegistrationFailed', 1, function($vars) { $domainname = $vars['sld'] . $vars['tld']; //$regerrormsg = $vars['error']; $command = 'OpenTicket'; $postData = array( 'deptid' => '3', 'subject' => 'Domain Registration Failure: '

Read More
PHP

Symfony Rate Limiter with additional blocking time option

I need a rate limiter where you can configure a separate blocking time when the limit has been exceeded. The use case would be, for example, that 20 accesses are allowed in one minute, if this number is exceeded, access should be blocked for 30 minutes. The usual Symfony rate limiters do not seem to

Read More
PHP

How can I stop WooCommerce from loading the Inter font on my product page?

I’m using WooCommerce on my WordPress site, and I noticed that it is loading a large font file called Inter-VariableFont_slnt,wght.woff2. This font file is as large as my entire page and is significantly slowing down the loading speed and blocking my FCP. My theme (Uncode) is already loading all the fonts I need, so I

Read More
PHP

Regular expression to identify CSS functions

I have a variable called $value that contains a string with a css expression. It can be a value or a function: rgb( 25, 128, 128 );, transform( -50% -50% );, bottom 50px right 100px;, #198080;, bold;, 1px solid red; I want to be able to identify if the expression contains a function or a

Read More