Scraping specific text from a webpage using xpath

I've searched and tried multiple ways to get this but I'm not sure why it won't find most of the information on the webpage. Page to scrape: https://m.safeguardproperties.com/ Info needed: Version number for PhotoDirect for Apple (currently 4.4.0) ...
more »

2017-10-04 23:10 (1) Answers

How to cache JSON API data in PHP?

I'm trying to understand how to cache data from an API (PokeAPI to be precise) to limit the amount of calls the application makes for the data. For example, one of my functions gets "All Pokemon" from the API: function getAllPokemon() { $url...
more »

2017-10-04 20:10 (1) Answers

How to Sort array alphabetical and by strlen

I am looking for the cleanest ways to sort array alphabetically and by strlen in PHP. The cleanest way i came up with to sort by strlen is this: array_multisort(array_map('strlen', $array), $array); How would i extend this to sort alphabetically b...
more »

2017-10-04 18:10 (1) Answers

How to stop mail() in php going into spam folder?

I am having a problem with my code when my website send register email to user, it goes into spam folder. This is the picture of email that got to spam. It also says that via gator4168.hostgator.com which what I don't want. This is the code I am us...
more »

2017-10-04 17:10 (1) Answers

Send mail by local server apache

i tried to test PHP mail function to send an email, i know that is not impossible to do from local server so i tried the sendmail.exe file and everything is work , but when i send the email no email is received 1- this is my send mail ini file settin...
more »

2017-10-04 17:10 (0) Answers

Csrf token issue with scaling

I have scaled my application to 3 different servers that use common mysql and redis service. Than I have set session and cache driver to my redis (they are working fine). But I still get token mismatch error. Did anyone solve this problem without tur...
more »

2017-10-04 16:10 (1) Answers

check or condition in where clause

I want to check OR condition for the variable role_id in role_mapping table. I want to check if user_id has role_id either '2' or '3'. User with user_id=210 has role_id 2 and 1. but my query result prints '3'. How to use or condition in Laravel query...
more »

2017-10-04 14:10 (1) Answers

Don't show empty parent category in Laravel

I have parent and child categories on the page. What I'm trying to do is when there is no products and no sub-categories assigned in some parent category to not be shown on the page. So I have this in Category model public function item() { re...
more »

2017-10-04 14:10 (1) Answers

Laravel use a custom validation message

I have made a custom rule in Laravel 5.5, but also want to get a custom translation with it from the lang validation file. For that I have now done: 'custom' => [ 'validate' => [ 'correct_password' => 'The :attribute is incorrec...
more »

2017-10-04 12:10 (1) Answers

How do I display message on the same page?

I have a quick question about my form. After submitting the form you will be directed to a page followed by the text that I put in. The problem is that I want this text to be displayed on the same page as where the form is on (named contact.html) I u...
more »

2017-10-04 12:10 (2) Answers

Symfony form validation pass array values

I'm new to Symfony. Here I'm trying to validate JSON parameters but I can't read array values. customer is my json object without array it's working. If I add array for bulk data insert I can't read array values. My code: $mydata = $request->ge...
more »

2017-10-04 12:10 (0) Answers

Turn SQL date red if it's not the current date

I'm creating a simple PHP to do list. I want to turn the date red if it's not the current date. Here's part of my code, with the HTML removed: <?php include "connection.php";?> <?php if ($_SERVER['REQUEST_METHOD'] == 'POST'){ $task = iss...
more »

2017-10-04 06:10 (1) Answers

Laravel collection filter by condition and split

I have a collection and each item has a featured attribute which is either true or false, so I want to get two variables $featured and $unfeatured. I can do this: $featured = $collection.filter(function($item){ return $item->featured; }); $u...
more »

2017-10-04 03:10 (2) Answers

How class/object relationships implemented in PHP

hypernym-hyponym (supertype-subtype) relations between types (classes) defining a taxonomic hierarchy, where for a subsumption relation: a hyponym (subtype, subclass) has a type-of (is-a) relationship with its hypernym (supertype, superclass); ho...
more »

2017-10-03 20:10 (0) Answers