php

PHP5 and Microsoft Live Search 2.0

I'm trying to use Live Search 2.0 but even a simple example doesn't seem to work. Microsoft only has example code for 1.1 and they're not giving out AppIDs for that version. Here's what I'm trying with: <?php $server = new SoapClient('http://soap.search.msn.com/webservices.asmx?wsdl'); class Search { public $Request; } class Sear...

What's wrong with this php/regex

The goal is to take the current working directory split it at /clients/ and see if the user is in [something]/clients/[their username]/[something] for example, the goal would be for input: cwd = "/volumes/raid0/www/clients/mikey/test_folder/" $session->username = "mikey" to return with $authorized = true I would like this to rec...

Strange reload effect in Firefox

Hi, I have a page generated by php which includes two drop-down lists (SELECTs) which contain a lot of items (about 2,000 each). The page is fine, but when it loads in Firefox, there's a delay during the load, and then it seems to refresh the entire page. If a user tries to click on anything before the "reload" occurs, it has no effect....

Programmatically combining images in PHP

I'm a big fan of Yahoo's recommendations for speeding up websites. One of the recommendations is to combine images where possible to cut down on size and the number of requests. However, I've noticed that while it can be easy to use CSS sprites for layouts, other image uses aren't as easily combined. The primary example I'm thinking of i...

Ignoring superscript in title tags

I work on a database driven website. Most pages' titles are the names of partners we have, and served from a database using php. For example one page might be called "Experian". The problem is that some of the values for partner names don't work because the values are things like $partnername22 = Discover<sup>tm</sup> Magazine I...

Java equivalent to PHP's preg_replace_callback

I'm in the process of moving an application from PHP to Java and there is heavy use of regular expressions in the code. I've run across something in PHP that doesn't seem to have a java equivalent: preg_replace_callback() For every match in the regex, it calls a function that is passed the match text as a parameter. As an example us...

Are there any programming languages targeting PHP, besides haXe?

PHP doesn't get much love but is still a winner at easy deployment (for cheap hosting). Are there any programming languages (besides haXe) that target PHP? Writing applications in this language and then translating it into PHP, like some languages target C as an intermediate language? The Scheme implementation Chicken compiles into C....

Why won't this standard Reg Ex work in PHP's ereg function

I am a bit of a newbie to Reg Ex and don't fully understand the difference between the different flavors. However, I have a basic Reg Ex that works when I try it via the UNIX system (vi and grep) but not when I try to to use it in PHP's ereg functions. I suspect there is something different about the PHP ereg function that is making this...

Is it possible to change an HTML element property using its ID with PHP?

Hi guys! I want to do something like this: page A has a link to page B page B gets content from a database and processes it the result from page B is displayed on a div in page A please notice that I don't want to leave page A while page B processes the information of the database. what I'm really trying to do is avoid using fra...

PHP/FTP ftp_put() throws weird error messages - what to do?

I use ftp_put / ftp_nb_put to upload files from my PHP server to another machine. I am frequently (90% of the time) getting absurd error messages like: Warning: ftp_nb_put(): 2 matches total Warning: ftp_nb_put(): Transfer complete Warning: ftp_nb_continue(): Opening BINARY mode data connection Now errors like "no such directory" or ...

Deep routes in Zend Framework without modules - how?

I'm writing some routes for a REST service. One of my resource's URI looks like this resources/user/:id I also want to give access to individual attributes of a user, which would look like this resources/user/:id/:attribute But when I try to define that latter route, it doesn't work. Here's my ini where the routes are defined rout...

Zend Framework - Zend_Form Decorator Issue

I have a class that extends Zend_Form like this (simplified): class Core_Form extends Zend_Form { protected static $_elementDecorators = array( 'ViewHelper', 'Errors', array('Label'), array('HtmlTag', array('tag' => 'li')), ); public function loadDefaultDecorators() { $this->set...

WHM: Moving an account to a new server

Hi There, I have an account on WHM for a PHP web app that's over 50GB in size on a dedicated server, the company decided to move it to a new server, and I was assigned the task. I would like to know what is the best way to do it, built-in WHM copy account function, or creating full backup and restore it to the new server? Thanks in ad...

Cookies across subdomains and hosts

In the application I'm writing using a combination of development environments and languages, I have need of accessing a cookie from two different subdomains, each on a separate host. The cookie is being set on www.mydomain.com using the PHP code that follows, and I'm attempting to access it from distant.mydomain.com on a separate host....

PHP - What should I call the information stored in my Page class?

Hi Stackers I have a class named Page with a private property currently called _pageData which stores all the information (such as title, content, keywords etc). However, this to me doesn't look so good when I refer to it $this->_pageData. I want to think of a better name, and I'd imagine there would probably be a standard or 'best pr...

PHP: printing undefined variables without warning

I'm just wondering if there is a quick way to echo undefined variables without getting a warning? (I can change error reporting level but I don't want to.) The smallest I have so far is: isset($variable)?$variable:'' I dislike this for a few reasons: It's a bit "wordy" and complex $variable is repeated The echoing of a blank string a...

Advantages of PHP CLI?

What are the benefits of PHP's CLI over other scripting languages/environments such as VBScript or even windows scripting? ...

Need help with extracting data with PHP Regular Expressions

I'm having trouble capturing this data: <tr> <td><span class="bodytext"><b>Contact:</b><b></b></span><span style='font-size:10.0pt;font-family:Verdana; mso-bidi-font-family:Arial'><b> </b> <span class="bodytext">John Doe</span> </span></td> </tr> ...

Zend Framework on nginx

The Zend Framework based site I have been working on is now being migrated to its production server. This server turns out to be nginx (surprise!). Naturally the site does not work correctly as it was developed on Apache and relies on an htaccess file. My question is... anyone have any experience with this? Any ideas on how to translat...

Giving PHP object-type arguments a default value

Hello, I'm writing a PHP application with testability in mind, so my classes always ask in their constructors for the "collaborator objects" they depend on, in respect to the Dependency Injection pattern. That way, I'm able to pass in mocks or test implementations in my unit tests. What I want to achieve though, is to be able to insta...