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

How to use the serializer for saving snapshot of complex entities

I’m working on a Symfony project where I have an entity called Richiesta that contains many nested relationships, some of which are OneToMany, ManyToOne, and ManyToMany associations. At a certain point in the process, I need to serialize all the data from the Richiesta entity (including its related entities) and save it as JSON in

Read More
PHP

php script getting error, this should download links of a webpage

fellow developers! I’m currently working on a PHP project where I need to: Extract all the URLs (especially links to downloadable files) from a webpage. ex: https://samplefile.download/sample-mp3-files/ Display these URLs so that I can choose which files to download. Finally, programmatically download only the selected files. <?php function get_webpage_content($url) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,

Read More
PHP

Which is better conditional rendering or separation of files in PHP?

i have a website where there are users with multiple privileges with difference in UIs and actions that are allowed/not allowed in the page , i have been overthinking about an approach that will make our lives more easier and we mainly have 3 privileges for now , i started already with conditional rendering however

Read More
PHP

Can I carry the key of an array element when passing it as argument to a function?

Given this array: $food = [ 'meat' => ['beef','chicken'], 'veg' => ['salad','onions'], ] and this function function foo($a) { print key($a); } invoking foo($food['meat']) returns 0 instead meat Since I need to know which element I’m working on I can add another argument to the function, but I wonder if there’s is a way to

Read More
PHP

Shared preferences not working in flutter

When installing shared_preferences, a problem occurs, and I have not used it yet. The problem also occurs when installing package: flutter_secure_storage platform_device_id dependencies: flutter: sdk: flutter shared_preferences: ^2.3.2 You need to sign in to view this answers

Read More
PHP

Analyzing the complete transaction information of Network bep 20 with API in PHP

Hello friends and teachers I want to get the information related to BEP20 network transaction in PHP through API or any other possible way. Information such as: Sender’s wallet address Receiver voltage address Transaction time and transaction amount Unfortunately, BCSscan.com’s API itself did not do this for me. Do you know a solution? You need

Read More
PHP

Sign in with Google

// authenticate code from Google OAuth Flow if (isset($_GET['code'])) { $token = $client->fetchAccessTokenWithAuthCode($_GET['code']); echo "yes code is there"; $client->setAccessToken($token['access_token']); } Error Warning: curl_setopt_array(): Cannot represent a stream of type Output as a STDIO FILE* in C:\xampp\htdocs\login_sysytems\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 57 Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in

Read More
PHP

Black background appearing on SVG when converted to PNG for mPDF library

I’m working on a feature that converts DOM content into a PDF using the mpdf/mpdf library from Composer/Packagist, and it generally works great. However, part of the DOM content is generated using C3.js to create charts. I convert the C3.js SVG to a PNG by drawing it onto a canvas so that it appears in

Read More
PHP

How to password protect a directory that contains an OpenCart shop

I have installed OpenCart in a folder on a hosted server. The reason why it’s in a folder and not the root, is that I only want people who login to have access to the shop and stay logged in while shopping. This has nothing to do with logging into OpenCart as they would have

Read More
PHP

PHP cURL OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054

I’m trying to run the PHP cURL request example of an API from a Windows/IIS web server Here is the code: <?php $curl = curl_init(); curl_setopt($curl, CURLOPT_SSLCERT, 'C:\...\cacert.pem'); curl_setopt($curl, CURLOPT_VERBOSE, true); $streamVerboseHandle = fopen('php://temp', 'w+'); curl_setopt($curl, CURLOPT_STDERR, $streamVerboseHandle); curl_setopt_array($curl, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30,

Read More