October 22, 2024
Chicago 12, Melborne City, USA
PHP

How do I pass a hidden text field as well as changle the form action

I have a script that will take a page name and change the form action, which will then take me to that page. However, I also want the ID for the page content to be passed to it. I assumed that a hidden field would work. I get the page, but there is no content.

Read More
PHP

Why is stdout not a tty?

Why is stdout not a tty, even though stderr is? Please let me know if you need more context, added this line to pass stackoverflow’s validation. $ php -r 'var_dump(exec("test -t 1 && echo y"));' string(0) "" $ php -r 'var_dump(system("test -t 1 && echo y"));' string(0) "" $ php -r 'var_dump(passthru("test -t 1 &&

Read More
PHP

codeigniter: Unable to call api folder in localhost

I am getting below error when i am trying to call the api folder url: localhost:82/macroflex/app/v1/api/login Error Not Found The requested URL was not found on this server. Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.1.25 Server at localhost Port 82 You need to sign in to view this answers

Read More
PHP

UTF8 encoding issue with code igniter 2, PHP 7.4, oracle 11

what are the settings that i need to fix in php.ini, apache to show utf8 encoded text stored in oracle db to be displayed properly in a web page? things i have done: default charset settings to utf8 added explicit encoding in oci_connect sample code: $conn = oci_connect('xxxx', 'xxx', 'xxx', 'AL32UTF8'); if (!$conn) { $e

Read More
PHP

How can I make these html & php patterns work?

I am trying to make an input with regex for the following pattern: Force start first character with a capital letter Force first character of other WORDS (letters) capital letter Force all other letters in words lowercase Allow numbers & special characters anywhere except 1st character of words <input type="text" name="display_name" placeholder="Display Name" id="display_name" required

Read More
PHP

Connect PHP to Microsoft SQL Server

I want to connect my domain website to an Microsoft SQL Server. I have done this before and it worked well. Im trying now with another SQL Server and it returns "A network-related or instance-specific error has occurred while establishing a connection". I’ve done all firewall stuff to allow that port, telnet cmd works fine,

Read More
PHP

API POST Request using HttpClientInterface

I am trying to do a POST request to an API using Symfony HttpClientInterface. But I am struggling as it always throwing 400 error. But when using cUrl it is working fine. $data = [ 'parameter1' => 'xxxxx', 'parameter2' => 'xxxxx', 'parameter3' => 'xxxxx', 'parameter4' => 'xxxxx', 'parameter5' => 'xxxxx', 'parameter6' => 'xxxxx', 'parameter7' =>

Read More
PHP

Get WooCommerce product attribute name value from its slug in the current context

I am building a custom table for products, I am attempting to add both simple products and variations to the same table. I have done this so far but I need to modify the title for variation products. I am attempting to do this format: "Product Title Black, 8 in." I have this code: foreach

Read More
PHP

PHP sends curl to submit a login request, it receives code 302, and the automatic jump will return Code 411

All tests can be completed in postman, and the Location page after login is displayed correctly. However, when the postman output as php-curl: <?php include('php/simple_html_dom.php'); $username="username"; $password = 'password'; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://somesite.com/', CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 10, CURLOPT_ENCODING => '', CURLOPT_FOLLOWLOCATION => true, CURLOPT_MAXREDIRS => 10, CURLOPT_CUSTOMREQUEST => 'GET',

Read More
PHP

How to unit test a symfony/console application command?

I use only the symfony/console@7.1 library to create a small cli application. I want to unit test the command as is, yet the the unit test provides no output. This is my unit test setup: class TimrOverviewCommandTest extends TestCase { public function testTimrOverviewCommand() { $input = new ArgvInput(argv: [ "overview", "--csv", "tests/csv/day_report.csv" ]); $buffered =

Read More