php

When should I use GET or POST method? What's the difference between them?

I think the title is my question. I would like to know what's the difference when using GET or POST method in php. Which one is more secure? What are dis/advantages of each of them? Thanks EDIT: I also found similar question to this one here. ...

How can I compare the values in two arrays?

It seems that every PHP function I read about for comparing arrays (array_diff(), array_intersect(), etc) compares for the existence of array elements. Given two multidimensional arrays with identical structure, how would you list the differences in values? Example Array 1 [User1] => Array ([public] => 1 [private] =>...

$_GET and URL Rewriting for PHP

How does URL rewriting affect the $_GET parameter for PHP? Say, for instance, I have a URL like http://example.com/index.php?p=contact and I use $_GET['p'] to tell index.php to serve the contact page. If I use a rewrite rule that converts the URL to http://example.com/contact, will $_GET['p'] still work as expected? If it does, could you...

Detect file encoding in PHP

I have a script which combines a number of files into one, and it breaks when one of the files has UTF8 encoding. I figure that I should be using the utf8_decode() function when reading the files, but I don't know how to tell which need decoding. My code is basically: $output = ''; foreach ($files as $filename) { $output .= file_ge...

Encoding issue with symfony framework, using Postgres as the database

I'm using symfony framework, and my db is Postgres. I export data from my tables into XML format. The european characters (those with umlaut) are messed up, inspite of using UTF-8 encoding. Any suggestions on how to fix this? ...

Escape HTML to PHP or Use Echo? Which is better?

In terms of performance , what would be better. Using PHP to echo all the HTML output so I can pepper it with the various bits of working code and variables or escape HTML to php periodically throughout the documents. I know there may be some readability issues but I'm not to worried about that. Thanks all! Example 1 echo '<html>', ...

Which tools should no PHP/Web developer live without?

There are lots of IDEs for PHP development, but I'm curious about all the OTHER brilliant little tools and apps and websites that people use every day to make PHP development a little easier. ...

sending mail from php script, giving me error.

I have a script that seemed to work before but no longer does. It is displaying this message after the script runs: Array ( [0] => Unrouteable address [1] => -All RCPT commands were rejected with this error: 503-Unrouteable address 503 valid RCPT command must precede DATA ) Array ( [0] => Unrouteable address [1] => -All RCPT commands w...

Google Style Regular Expression Search

Hi all, It's been several years since I have used regular expressions, and I was hoping I could get some help on something I'm working on. You know how google's search is quite powerful and will take stuff inside quotes as a literal phrase and things with a minus sign in front of them as not included. Example: "this is literal" -donotfi...

Exchange Server 2007 Web Services PHP Class

Does anyone know of an open source PHP class (preferably BSD or MIT license) that will interface with the MS Exchange Server 2007 Web Services via. SOAP? I am looking for a higher level class that has functionality for sending messages via. the web service. ...

how to get last inserted Id of a Sqlite database using Zend_Db

I'm trying to fetch the last inserted row Id of a Sqlite DB in my PHP application. I'm using Zend Framework's PDO Sqlite adapter for database handling. the lastInsertId() method is supposed to give me the results, but it wouldn't. In PDO documentation in php.net I read that the lastInsertId() might not work the same on all databases. but...

Warning: Cannot modify header information - headers already sent by

when am running player.php its giving an error Warning: Cannot modify header information - headers already sent by (output started at /www/110mb.com/m/u/s/i/c/k/i/n/musicking/htdocs/player.php:8) in /www/110mb.com/m/u/s/i/c/k/i/n/musicking/htdocs/player.php on line 24 can u plz help? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transi...

Project Euler #5 php doubt!!!

problem euler #5 i found the solution but i don't know why this first code is faster (i put 14 in order to try to make more clear the code) the only difference is that i eliminate the for i wrote for a huge if if($num%14==0 && $num%13==0 &&$num%12==0 &&$num%11==0 &&$num%10==0 && $num%9==0 && $num%8==0 && $num%7==0 && $num%6==0 && $num%...

How to distinguish between user roles in wordpress?

I am trying to limit what content the subscribers can see but nothing I do seems to work. I have spent hours trawling the web and through the wordpress code, all to no avail. Does anyone know how I would be able to go about this? Ideally the code structure would look like: if(get_role() = 'subscriber'){ redirect } Thanks Inciden...

How to use swig to generate php interface for c++ so

Ok, I have tried a 100 things and i can not get my so file to interface with php using swig. I can generate the files, then i had to compile zend and link with that to make the so but it keeps seg faulting on load now. Can some one please walk me though how to use swig to generate a php interface for a c++ so as the one on there site i...

what is the most efficient way to fully resolve a url (using php and curl)

I'm looking for the most effecient way to resolve a given url to its final end point, following all 30x redirects and location headers. Basically, I have a bunch of URLs like http://foo.com that when you go to them, they end up at a page like http://foo.com/Welcome.html and i need to find that last url. right now, i'm using CURLOPT_FOL...

PHP: get classname from static call in extended class.

Hello anyone. Here is the situation. I have two classes: Action, and MyAction, last one is declared as: class MyAction extends Action {/* some methods here */} All i need is method in Action class(only in it, cuz there will be a lot of inherited classes, and i don't want to implement that method in all of them), which will return clas...

mysqli problem - prepared statements

Hello, I have the following snippet of code from my application, which should work. However, i get the error that: Warning: mysqli_stmt::bind_result() [mysqli-stmt.bind-result]: Number of bind variables doesn't match number of fields in prepared statement in file. I am using the exact number of columns to bind as to select, and using l...

PHP - Outputting specific content from an array.

How do I output the [Comment][title]s one after another in this array? Array ( [User] => Array ( [id] => 121 [name] => Gwoo the Kungwoo [created] => 2007-05-01 10:31:01 ) [Comment] => Array ( [0] => Array ( [id] => 123 ...

Websphere single sign on from PHP site?

I need to provide SSO for a Webpshere portal. The authentication process needs to be handled by a PHP site (which itself should authenticate a user against an Active Directory via LDAP - think I have this bit covered though). I have been told I need to create an LTPA cookie. How would I go about doing this? What information need to be se...