Skip to content

Tag: php

Guzzle returns cURL error 3: malformed

I want to try out the guzzle library and am following through their quickstart tutorial to make http requests to an api. Yet it doesn’t seem to work, because I get the following error: Since I have never worked with cURL before, I don’t even know how to respond to that error message. Here is my co…

PHP Dropdown Box from SQL Join

I want to do is have a dropdown box that will display the MealOption and when that is selected somehow find that products meal id? This is my database layout

Laravel sort collection and then by key

I am making raking system for my users and here’s what I have so far: Get all users and sort them by points – it works fine. $users = User::all(); $users = $users->sortByDesc(function($item){ …

Get location from latitude and longitude in PHP

I want to get address, city, state and country in different variables so that I can display it separately but due to different latlong, somewhere I am getting whole address and somewhere only state and country, so I am not able to get a specific address due to changing latlong. Here is my code: Answer Try Bel…

Is it possible to enable CORS in the PHP CLI server?

Is it possible to enable CORS in the PHP CLI server (and if so, how)? Edit: To address comments such as I should just include the header in my scripts, note that I do not have any PHP files/scripts in my code. I am simply using the PHP CLI server as a lightweight local hosting option. Thus ideally the answer