I have a class with methods that I want to use as callbacks. How can I pass them as arguments? Answer Check the callable manual to see all the different ways to pass a function as a callback. I copied that manual here and added some examples of each approach based on your scenario. Callable A PHP function is …
Tag: php
PHP Warning: file_get_contents(http://ipecho.net/plain): failed to open stream: Connection timed out in
I have an error here and I don’t know where the problem is exactly. I am trying to make a PHP file and deny anyone to use the script except the IP that I have entered into the code: When I use the code Ii have problem Answer Why you use that site for getting the client’s IP? You can
Download images from html and keep the folder structure
I need to have download over 100.000 pictures. The Pictures have : .png, .jpg, .jpeg, .gif format. I have the approval to use those pictures. they have provide me an XML file with all the url`s The url have the structure otherdomain/productimages/code/imagename.jpg/.png/.gif I have all the codes in an php arr…
Eloquent attach/detach/sync fires any event?
I have a laravel project, and I need to make some calculations immediately after I save a model and attach some data to it. Is there any event that is triggered in laravel after calling attach (or …
$_FILES to a resource – Laravel 5 and Dropbox
Well, I’ve uploaded an app to Heroku, and I’ve discovered that I can’t upload files to it. Then I started to use Dropbox as storage option, and I’ve done a few tests, of send and retrieve link, and all worked fine. Now, the problem is to use the uploadFile() method on DropboxAdapter. H…
Use proxy to connect to a mysql db through PDO
I’m trying to connect to a remote mysql database with PHP PDO (php version 5.3) and I need it to go through a proxy. My connection looks like this right now. I’dd need it to go through a proxy, like http://proxy.mydomain.com:port I’ve searched through the PDO Doc and can’t seem to find…
Translate queued mails (localization)
I am looking for a working solution, to translate queued emails in laravel-5. Unfortunately, all emails use the default locale (defined under app.locale). Let’s assume, we have two emails in the …
What does isDirty() mean in Laravel?
First of all, I am not familiar with Laravel so much (or with the term “dirty” for that matter). I stumbled upon this line of code – And I couldn’t understand what that means exactly. I tried to find out on the internet but the Laravel site only says this “Determine if a given at…
PHP array stringify
In a lyrics application I’m coding, I’m using an array to print an artists table. The artists array looks like this: Before printing it, I do some modification to the array. I have a folder for each artist that contains the lyrics files. I add the folder names to the $artists array for later use: …
How to send to BCC address when using PHPMailer to format MIME message for Gmail API?
I am using PHPMailer to build an email message. I am using PHPMailer only for MIME message formatting, not sending. I then extract the raw message from the PHPMailer object before passing it on to the Gmail API for processing. According to PHPMailer docs, CC and BCC only function for sending in the Win32 envi…