Skip to content

Tag: php

Make a HTTPS request through PHP and get response

I want to make HTTPS request through PHP to a server and get the response. something similar to this ruby code Thanks Answer this might work, give it a shot. $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); // Set so curl_exec returns the result instead of outputting it. curl_setopt($ch, CURLOPT_RETURN…

pdf download html2pdf

i am using html2pdf class to generate pdf. in my problem its generate pdf for the html code but it not give the dialog box option to download that pdf. plz help my cose is following. <?php …

Slow MySQL full text search

I’m using this query to perform a full text search on a MySQL database: The results are very relevant, but the search is really slow and is getting slower and slower as the tables grow. Table stats: questions – 400 records indexes PRIMARY BTREE – id BTREE – uniquecode BTREE – que…

Multiple $_POST on same page PHP

I have a question. Currently this form will be dynamically generated. Example, So whenever i press submit, it will take last value of form only. How do i make it take all $_POST? Thank you. Answer Give each input its own name or use: Then PHP will treat it like an array.

How do I use a class method as a callback function?

If I use array_walk inside a class function to call another function of the same class It gives me the following error – Warning: array_walk() [function.array-walk]: Unable to call test_print() – function does not exist in … So, how do I specify $this->test_print() while using array_walk(…

Sending POST data without form

Can i send for example a string or another piece of information to another .php file without it being exposed [thus not by GET but by POST conform to what i know] without using a form? Answer If you don’t want your data to be seen by the user, use a PHP session. Data in a post request is still

PHP calculate age

I’m looking for a way to calculate the age of a person, given their DOB in the format dd/mm/yyyy. I was using the following function which worked fine for several months until some kind of glitch caused the while loop to never end and grind the entire site to a halt. Since there are almost 100,000 DOBs …