Category "php"

Laravel 5 controller sending JSON integer as string

On my development server the JSON response from the Laravel 5 controller shows the data in the correct types. e.g imdb_rating: 7.6 imdb_votes: 6271 But on t

Transpose csv file data [duplicate]

I need help to assign keys to an array in PHP. My code is: //First I make an array of a csv file $file="C:\path-to-csv\file.csv"; $csv= file

Creating a config file in PHP

I want to create a config file for my PHP project, but I'm not sure what the best way to do this is. I have 3 ideas so far. 1-Use Variable $config['hostname'

Limit WooCommerce products in cart only from one custom taxonomy

I'm trying to restrict customers on my Woocommerce store to only be allowed to order products from 1 "supplier" at a time. I am defining the "Supplier" by a cus

file_get_contents() without "Http" to access external URL [closed]

I'm attempting to access an external URL (API) echo file_get_contents("http://..."); However, I want to request this URL without the "Http://

Cannot pass null argument when using type hinting

The following code: class Type { } function foo(Type $t) { } foo(null); failed at run time: PHP Fatal error: Argument 1 passed to foo() must not be null

Get keys from associative array [duplicate]

I have this array: Array ( [7] => 12 [5] => 11 [4] => 11 [2] => 9 [8] => 7 [1] => 6 [3] => 6 [6] => 5 [23] => 3 [3

Get keys from associative array [duplicate]

I have this array: Array ( [7] => 12 [5] => 11 [4] => 11 [2] => 9 [8] => 7 [1] => 6 [3] => 6 [6] => 5 [23] => 3 [3

How to solve cURL error 60: SSL certificate in Laravel 5 while Facebook authentication

Currently, I am doing a project on laravel5. I use socialize for Facebook authentication,But I got cURL error Mentioned below. RequestException in CurlFactor

How avoid Moved Permanently The document has moved here

I'm in a site and I would call an API that is in another site. So I build a curl $url = ........ $curl_data = array('name'=>$name); $ch = curl_init(); cur

How to get the ID of the link in another page in php

I like to catch the id of below tag in show.php file once the link is clicked... I have already got the href name in show.php <?php if (isset($_GET['subm

how to pass row id in href of a tag in codeigniter controller?

I am using jqxgrid in codeigniter to display records from mysql database. while displaying the data, I made a column named 'action' that contains edit a tag to

php code to send checkbox form results to email

Would really appreciate some help for a php novice! HTML form has the following checkbox list: <input type="checkbox" name="servicetype[]" value="Optio

Create tags in laravel post publishing

Currently when I want to add tags in my posts I have to go to my tags page and create them then go to my post create page and add them to my post by multiple in

How can I access an array/object?

I have the following array and when I do print_r(array_values($get_user));, I get: Array ( [0] => 10499478683521864 [1] => 07/22/1983

Laravel 5 session not persisting after user is logged in

I'm having an interesting issue with Laravel 5. After logging in a user, the logged in status is not persisted across pages. Clearly it has something to do wit

retrieve data from database using session

Hi I had read topics here and tried doing it in different ways but my problem still not solved. I tried storing session and use it to retrieve data again from t

Possible bug with getTransitions in PHP 8.1?

I know a lot of date-related bugs have been fixed in PHP 8.1, but it may have introduced new ones... Take this code: $time_zone_id = 'America/Vancouver'; $timeZ

Woocommerce Edit Message "An account is already registered with your email address. Please log in."

I am looking to overwrite this message via functions.php through a child's theme. I have seen some examples through here and here. I would prefer using a filte

Only on Firefox "Loading failed for the <script> with source"

I want to integrate Marketo form with my existing website on yii framework. My code works on all the browsers except Firefox. Excerpt from my code: $('#bu