php

PHP SoapClient times out

I'm trying to call a Soap Client for testing purposes from the same server that I'm running the service on. My WSDL is at: http://www.installittoday.com/api/server.php?wsdl I'm trying to load it simply with: $client = new SoapClient('http://www.installittoday.com/api/server.php?wsdl'); but I get back the error: Warning: Soap...

php string parse with look ahead

I have this string in PHP: $string = "name=Shake & Bake&difficulty=easy"; For which I want to parse into array: Array ( [name] => Shake & Bake [difficulty] => easy ) NOT: Array ( [name] => Shake [difficulty] => easy ) What is the most efficient way to do this ? ...

How to get started deploying PHP applications from a subversion repository?

I've heard the phrase "deploying applications" which sounds much better/easier/more reliable than uploading individual changed files to a server, but I don't know where to begin. I have a Zend Framework application that is under version control (in a Subversion repository). How do I go about "deploying" my application? What should I do ...

How can I map an integer value to a string more easily in PHP?

How can I re-factor the following code to make it more concise and more maintainable? if ($row['vocation'] == 1) $vocation = "sorcerer"; if ($row['vocation'] == 2) $vocation = "druid"; if ($row['vocation'] == 3) $vocation = "paladin"; if ($row['vocation'] == 4) $vocation = "knight"; if ($row['vocation'] == 5) $vocation = "master...

MVC done right - Examples

I am new to both the MVC pattern and PHP frameworks. I picked up a copy of CodeIgniter for Rapid PHP Application Development, but the author does not use the M part of MVC and I can't seem to get his code examples to work. CodeIgniter's User Guide is not very detailed about what goes into which component either. What I'm looking for are...

Output content from wordpress plugin and rewrite rules

I have created a wordpress plugin that has a filter on the_content, looking for a specific tag then outputting the plugin content in place of that tag. I would now like to use rewrite rules to call the plugin and output the data within the template, but I'm not finding much help. Can someone provide an example, or some guidance on how ...

How do I Extend Zend View to Implement a Concrete Function?

I want to make it as easy as possible for our designers to localise strings in views, which means that I want to do this: ... <p><?php echo $this->_("Hello, world!"); ?></p> ... The underscore notation here is necessary to allow Poedit to automagically extract all strings for localisation. The implementation is trivial: public functi...

How to encrypt string without mcrypt library in php

in function need key to encrypt string without mcrypt libraly in php function encrypt($str, $pass){ $str_arr = str_split($str); $pass_arr = str_split($pass); $add = 0; $div = strlen($str) / strlen($pass); while ($add <= $div) { $newpass .= $pass; $add++; } ...

PHP Retrieving data problem

Hi, I have this weird problem where PHP5 is not retrieving ints from a MySql database. This is the code I have: $db = mysql_connect('XX.XX.XX.XX', 'DBName', 'DBPwd'); $query = 'Select * FROM Users WHERE UserName = \'Carlo\''; $result = mysql_query($query); if(!$result) { echo 'Could not successfuly run query: '.mysql_error(); exi...

AJAX (prototype/php) getting partial status updates during script execution

I have a process I want to run in the background of a page. The process will take a while to run, lets say a few minutes. I have it set up so that from the page I can click on a button to start the process off, wait a bit and then it will finish and I can have the page update notifying me that the process was run successfully. I'm doing...

PHP: HTML markup problem while displaying trimmed HTML markups

I am using a Richtext box control to post some data in one page. and I am saving the data to my db table with the HTML mark up Ex : This is <b >my bold </b > text I am displaying the first 50 characters of this column in another page. Now When i am saving, if i save a Sentence (with more than 50 chars )with bold tag applied and in my ot...

Looking for a PHP and/or Python RAD

I am looking for RAD like environment for PHP and/or Python free or not does not matter. It should have a visual environment where one can use a point and click interface so that it is possible to select objects with mouse and move them around. I have looked at Delphi4PHP. The RAD part is fantastic, but I don't like the framework on wh...

Unit testing in PHP?

I've been thinking about writing unit tests for my PHP/MySQL projects. The thing that bugs me is how i can test things like form validation, ajax features, and UI features (such as clicking links). Also, I don't want the tests to be dependent on one aspect of the UI, so if I moved one link then all tests would break. Does anyone have a...

How to find "FooBar" when seaching "Foo Bar" in Zend Lucene

I'm building a search function for a php website using Zend Lucene and i'm having a problem. My web site is a Shop Director (something like that). For example i have a shop named "FooBar" but my visitors seach for "Foo Bar" and get zero results. Also if a shop is named "Foo Bar" and visitor seaches "FooBar" nothing is found. I tried t...

SQL design and / or PHP class for storing dynamic two-dimensional arrays?

I need an elegant way to store dynamic arrays (basically spreadsheets without all the functionality) of various sizes (both x and y), mostly being used as ENUMs, lists, lookup data, price sheets, that sort of thing. Multi-lingual would be a great bonus. Speed of the essence. Here's an example of a typical "sheet" ; | 1 | ...

How to replace double/more letters to a single letter?

Hi I need to convert any letter that occur twice or more within a word with a single letter of itself. For example: School -> Schol Google -> Gogle Gooooogle -> Gogle VooDoo -> Vodo I tried the following, but stuck at the second parameter in eregi_replace. $word = 'Goooogle'; $word2 = eregi_replace("([a-z]{2,})", "?", $word); If ...

client and context sensitive help application (php solution)

Need some input: Which are the most advanced context sensitive help applications for php environments? The content has to be filterable by client and language. ...

How to count and limit record in a single query in MYSQL?

I am searching for records in a table as follows: SELECT Id, Name FROM my_table WHERE Name LIKE '%prashant%' LIMIT 0, 10; Now, I am adding LIMIT to maintain my paging. But when user searches for word 'prashant' then total records I have is 124 for 'prashant'. But as the limit applied to the query so it only fetches 10 records in my PH...

PHP file() generates error: failed to open stream

I have a script with line: $id = strtolower(implode('',file($ip_service . $ip))); When executed the file function will be like file(http://www.url.com/filename.php?119.160.120.38) On server A it works fine but on Server B it gives following error: file(http://www.url.com/filename.php?xxx.xxx.xxx.xxx) [function.file]: failed to op...

How to convince fellow programmers to use Gettext?

I have used GNU Gettext successfully in many projects I have worked in, but at my latest job I have suddenly found myself forced to work with a really awkward localization system. The current system stores translations in database and adding new translation goes something like this: add function call with translation key to source cod...