Skip to content

How to return a file in PHP

I have a file /file.zip A user comes to /download.php I want the user’s browser to start downloading the file. How do i do that? Does readfile open the file on server, which seems like an …

How to Convert Arabic Characters to Unicode Using PHP

I want to to know how can I convert a word into unicode exactly like: http://www.arabunic.free.fr/ can anyone know how to do that using PHP considering that Arabic text may contains ligatures? thanks Edit I’m not sure what is that “unicode” but I need to have the Arabic Character in it&#8217…

AJAX + jQuery variables do not pass to PHP

I am trying to do something very simple: Pass 2 text variables to a php script and insert them into a MySQL db. For some reason however I can’t get the variables to pass (so I just get empty records in my DB). And the PHP: Anyone willing to take a quick look at it and point out my -probably

Send string as a file using curl and php

I know I can use this syntaxt to send a file using php, post and curl. $post = array( “file_box”=>”@/path/to/myfile.jpg”, ); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); How can I take a …

Get value of dynamically chosen class constant in PHP

I would like to be able to do something like this: This doesn’t work. Is there a straightforward way of doing something equivalent? Note that I’m stuck with the class; it’s in a library I can’t rewrite. I’m writing code that takes arguments on the command line, and I would really…

How to print SQL statement in codeigniter model

I have a sql statement in my model, I then say $query = $this->db->query($sql, array(fields, fields1); if ($query) { return true: } else { echo “failed”; return false; } My query …

PHPMailer could not connect to SMTP host

getting following error: SMTP -> ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: No such host is known. (0) SMTP Error: Could not connect to SMTP host. There was a problem sending this mail! This is my config file setting as I have followed this PHPMailer tutorial and used…