What is the general way of handling complex results from functions with an object? A simple method might return true or false, and that would be all I need to know. A more complex method might return true or false, but there might be more information I would want to get out of the class, such as why it failed ( there might be several rea...
I want to use PHP and DomXPath::query to get the parent "form" element of a submit button. The variable $dom holds the complete DOM tree and $node represents the submit button as a DOM node.
$query = '??????';
$xpath = new \DomXPath( $dom );
$parents = $xpath->query( $query, $node );
if ( $parents->length )
{
$form = $parents->it...
When using the $_GET[] in php, it searches for a variable e.g ?id=value
Is there a way to call the #value instead?
...
I am working on a form spam protection class which essentially replaces form field names with an encrypted value using mcrypt. The problem with this is that mcrypt encryption is not limited to only alphanumeric characters which would invalidate form fields. Given the code below, can you think of any reason why I'd be having problems de...
Assuming my project is utf-8 throughout and has always been used with utf-8 encoding, is there anything legit that could possibly break if I change all occurances of htmlspecialchars($var) to htmlspecialchars($var, ENT_QUOTES, 'utf-8')?
I do know one thing: Obviously, ENT_QUOTES differs from ENT_COMPAT in that it also escapes single quo...
<?
$request_url = 'http://www.betjamaica.com/livelines2008/lines.asmx/Load_Latest_Lines?SportType=Football&SportSubType=NFL&GameType=GAME';
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exe...
I have made the lovely discovery that Jquery corners are not working on Chrome. Any solution for that?
I just figured out that when I turn of my config.js file that holds this (rounded corners functions):
$(document).ready( function(){
if(navigator.appName!="Microsoft Internet Explorer") {
$('.round_10px').corners("10px");
...
I know that in normal php regex (ASCII mode) "\w" (word) means "letter, number, and _". But what does it mean when you are using multibyte regex with the "u" modifier?
preg_replace('/\W/u', '', $string);
...
Hello all,
Quick question. How would I go about displaying comments to a static page from a comment box on a blog page where we are capturing name and email address and a short comment.
One page would have the comment box and the static page will have the comments.
Any help would do...
Thanks,
...
Hey All!
So I am somewhat new to symfony but am getting better by the day thanks to the symfony websites and stackoverflow! So, I have a module called articles, where I display a list of articles the I uploaded. On the index, its just lists all of the article. BUt i was wondering how I could make it so that if I click on the author, for...
There is a plugin that I am trying to adapt for my meta_tags for use with WordPress.
It is called Categories by Title by http://www.mikesmullin.com.
What I am trying to achieve is a nested sort. I have three meta_keys. A selection-no, release-month, and release-year. I would like to sort posts within their category by release-year (as...
I am writing a web app that needs Twitter user's profile photos only. I retrieve these by parsing the users/show XML unauthenticated API call (http://apiwiki.twitter.com/Twitter-REST-API-Method:-users%C2%A0show):
$twitterXML = simplexml_load_file("http://twitter.com/users/show/".$twitterUsername.".xml");
In my testing I have been hitt...
By looking at the name of this directive one may think that magic_quotes are only applied to $_GET, $_POST and $_COOKIE superglobals but there is one perturbing comment on the PHP Manual:
Please note, that when
magic_quotes_gpc is set not only
$_POST, $_GET, $_REQUEST, $_COOKIE
arrays values are slashed. Actually
every string...
Hi,
I would like to try to read some of text from an image with PHP.
So if I have an image like this:
Can I some how extract the "Some text" into a string.
All help and suggestions are appreciated.
...
I am trying to get the name of the role of the currently logged in admin. I can get the admin user, but I can't figure out how to query their role name. The Magento docs are weak =/
$usr = Mage::getSingleton('admin/session')->getUser();
Ideas anyone?
...
I have user submitted tags that can be any type of (valid) UTF-8 string. I want to know if it is safe to include them in the URL merly by running them through urlencode().
In other words, is urlencode() safe to use for valid UTF-8 strings?
(by valid I mean id have already force-encoded them to UTF-8)
...
I have a python script which is freezing (I think it stalls waiting for socket data somewhere), but I am having trouble getting a backtrace because the only way to stop it is to kill the process in. There is a timeout on the socket also, but it doesn't seem to work.
I am hoping that Python has a feature like PHP's set_time_limit() funct...
A WordPress build i am working on wants to pull in stories from rss feeds, and then allow users of the site to add comments and star ratings to each one.
It doesn't really seem like the correct useage of rss to me, but is this sort of thing possible without importing/syncing the rss feeds with the database?
...
I am facing a weird situation. When I am trying to connect to MySql database using a "mysql" connection, it works.
mysql connection string -> mysql_connect($HOST, $USER, $PASSWORD, $DB);
But the connection fails immediately fails when I use either "mysqli" or "PDO"
mysqli connection string -> mysqli_connect($HOST, $USER, $PASSWORD, ...
hi, can someone please tell me what Im missing? this simple script
<?
session_start();
?>
displays the following error message:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\test3\index.php:1) in C:\xampp\htdocs\test3\index.php on line...