Skip to content

Tag: php

SFTP Opendir failing when called via Function

I have a bunch of php pages that are running on a schedule that pull data from different SFTP sources, to try and minimise this as a temporary fix I am turning them into functions and having one page that calls each of them However, when converting these to functions the pages are giving me error 500, through…

Problem with WordPress call_user_func_array() and add_action

I am programming a WordPress plugin, but I had trouble creating WordPress metadata. Please guide me. Thanks My metabox file code : Note: I am creating a metadata for posts. Answer You have added wp_api_savee_prices_metabox function inside wp_api_add_price_metabox Try the below code.

Need to pass dynamic values inside CURLOPT_POSTFIELDS

I have to make a post request and have done the same using postman for testing. Now, the code base is using php and I have never used php ever before. Upon checking the code section in postman, I got this: The problem is that I have to pass dynamic values instead of firstname, lastname4 etc. The values I have

Setup a whole range of PHP if statements for code to pull from

I have a whole bunch of values, that need to correspond to some other values. I’ve so far setup an array as per the below: I also have a variable, $input that provides a number value. I need to figure out a way to say something like: My array list will end up having hundreds of values in it, so

PHP – get URL param with or without key

I know how to do this in a clunky verbose way, but is there an elegant way to retrieve a single param from a URL whether or not there is a key or index page in the URL? i.e. there will never be a &secondparam=blah. $_GET[“slug”] only works if the url has slug=foobar E.g. return foobar for any …