Skip to content

Tag: php

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…

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…

Search for highest key/index in an array

How can I get the highest key/index in an array with php? I know how to do it for the values. E.g.: from this array I would like to get 10 as an integer value: I know how I could code it but I was asking myself if there is a function for this as well. Answer This should work

Page redirect after certain time PHP

There is a certain PHP function for redirecting after some time. I saw it somewhere but can’t remember. It’s like the gmail redirection after logging in. Please, could anyone remind me? Answer this is the php way to set header which will redirect you to wherever.php in 5 seconds Remember that head…