Skip to content

Tag: php

PHP Built-In Server Can’t cURL

I have a relatively simple script like the following: When I execute it on the command line, it works – I get the meager results from within test.html. When I run this script by loading up the built-in PHP server and browsing to the script, it hangs. No output to the screen, nothing written to the logs.…

How to join three table by laravel eloquent model

I have three table Articles table Categories table User table I want to show articles with their category name instead of category_id and user_name instead of user_id I try like these query It is work! But I want to do by Eloquent way. Please, how could I do? Answer With Eloquent it’s very easy to retri…

How to get last modified text files by date from remote FTP location

I am stuck on atomization of an process to download last modified text files on date wise or today. Here is my code. I got success in getting text files, but not selecting the last modified files, filemtime is not helping me nor curl. Answer Since PHP 7.2, you can use ftp_mlsd function to retrieve list of fil…

List all registered variables inside a Laravel view

I am using Laravel 5. I would like to know which are all variables passed to a view inside the view itself. Since all variables are in the view scope I thought I could use the generic PHP function: get_defined_vars(); http://php.net/manual/en/function.get-defined-vars.php Something like this: But I would like…

Laravel connect to a SQL Server 2008 named instance

I am trying to connect an SQL server from an Ubuntu machine, everythings works great except for named instances: this works this doesn’t I always end up with this error: I have tried every possible combination: host INSTANCE host / INSTANCE host \ INSTANCE Can someone help me ? Edit: Because I have als…

Detect BST in php

I am building a booking system in php that offers session times for people to book outdoor activities. In the summer months, there is an extra session available at the end of the day, because of Daylight Savings, there is an extra hour in the evenings. I am using this… I only need to show this extra opt…

Applying Cursors pagination in elasticaserch

Im new to elasticasearch and trying to apply the cursor paginatoin seen in facebook, twitter for my api. Is there a way to apply that throw filters, aggregations i already tried a couple queries but the issue that i can reserve the order of the documents, any help will be appreciated ? Answer You can paginate…