php

Extracting the common words between two paragraphs?

How can I extract the common words between two or more paragraphs in php5? I guess it might work to summarize each text to create a list of highly ranked words and then compare them. Any suggestions or help would highly appreciated. ...

Including variables inside curly braces in a Zend config ini file on Linux

I am trying to include a variable in a .ini file setting by surrounding it with curly braces, and Zend is complaining that it cannot parse it properly on Linux. It works properly on Windows, though: welcome_message = Welcome, {0}. This is the error that is being thrown on Linux: : Uncaught exception 'Zend_Config_Exception' with mess...

Static classes in PHP via abstract keyword?

According to the PHP manual, a class like this: abstract class Example {} cannot be instantiated. If I need a class without instance, e.g. for a registry pattern: class Registry {} // and later: echo Registry::$someValue; would it be considered good style to simply declare the class as abstract? If not, what are the advantages of h...

Is there a way in PHP to keep a file open and process each line and subsequent lines?

I want to write a php script that keeps the apache_log file open and "listen" to the log and deal with each log entry as it happens. I'm thinking that I need to open a file, get the number of lines, then do this again in a loop - and when the size is different, read the new lines and process them. Am I barking up the wrong tree, or is ...

Sending IGMP with PHP

Can I send out IGMP packets with a PHP script? Is IGMP even on the Transport Layer? I was looking at some JOIN packets that are destined for 224.0.0.251. I noticed that the IP header had no port assigned but did have MAC addresses specified, which led me to believe that IGMP was not on the Transport Layer but rather on the Network Lay...

Opposite of nl2br? Is it str_replace?

So the function nl2br is handy. Except in my web app, I want to do the opposite, interpret line breaks as new lines, since they will be echoed into a pre-filled form. str_replace can take <br /> and replace it with whatever I want, but if I put in \n, it echoes literally a backslash and an n. It only works if I put a literal line break ...

Adding a third table to a Join

Hello, This query works fine: $sqlStr = "SELECT s.loginid, s.title, s.url, s.displayurl, l.username FROM submission AS s, login AS l WHERE s.loginid = l.loginid ORDER BY s.datesubmitted DESC LIMIT 10"; Would this work if I wanted to join a third MySQL table (called "comm...

Strategies for Accessing a Application with a COM API From PHP

Background: Experienced PHP developer with a mostly *nix background. I'm writing a PHP application that needs to interact with a proprietary 3rd party system. The 3rd party system is Windows only. The PHP application will be living on a separate Linux based system The 3rd party application has been described as having a "COM API" th...

What's wrong with this code?

$code = $_POST['code']; echo "<script language='javascript'> document.getElementById('code').value = $code </script>"; I tried '$code', "$code","..." + "%code + "...", and i cant change the textfield's value to the PHP value. Mmm!!! ...

Flex 3 or Flash Builder 4 for development of Church management system.

hello, i am a learner of flex 3 builder and i have downloaded the Flash Builder beta 2. i have been experimenting with it for a while, i have been given the task to develop a church management system for my church. Because i am new to both technologies, i wanted advice actually as to which will be fastest to build such an application. T...

Making a query result equal to zero when a condition is null

Hello, I believe the query below should work. However, when I run it, the results are blank. I think this is happening since for now, the table "comment" is empty. So there is no instance where s.submissionid = c.submissionid. I would like to have the query below to work even if there if no s.submissionid that equals a c.submissioni...

PHP CMS with independent framework.

We currently use MySource Matrix CMS for large projects, Wordpress CMS for small projects and Zend Framework for bespoke applications... I'm not trying to confuse and compare a CMS to a framework, that has been done before :-) I want to identify a few CMSs for review that have foundations in strong (preferably independent) PHP framewor...

"viewed" system - once per user

I need to implement "viewed" system. How it can be done, so that pressing F5 would not increase viewed number for more than 1 per user? SO also has such system. Cookies, sessions, db? How it is usually done? ...

How to manually create Friendly URLs? (PHP)

How to manually create Friendly URLs? (PHP) So I have created simple php file which echos requested string. Now it has form echo.php?string=bla+bla+bla&font=times I want to see it like echo/bla+bla+bla/times How to do such thing (not using external libs)? ...

loading XML string into Xslt sheet

I am trying to load a xml document I created using PHP and DOM into a xslt sheet, but having no luck. $xml_string = $doc->saveXML(); //echo $xml_string; $xml = new DOMDocument; $xml->load($xml_string); $xsl = new DOMDocument; $xsl->load('musicInformation.xslt'); // Configure the transformer $proc = new XSLTProcessor; $proc->importS...

Swift Mailer email sending problem

i have downloaded Swift Mailer from their website and try to send simple email with following code <?php require_once 'lib/swift_required.php'; $transport = Swift_SmtpTransport::newInstance('smtp.example.org', 25) ->setUsername('your username') ->setPassword('your password') ; $mailer = Swift_Mailer...

Best XMPP Client PHP/Javascript

Which one is the best XMPP client library for PHP/javascript? I have gone through many of these like: JSJaC XMPPHP MISSUS Kaazing Gateway Some one having experience in using these will have better idea. ...

Where can I find an introduction to using PDO?

I know my SQL safety isn't up to par. I've read on this site that PHP PDO would be a good first step, and while I did take a look at the PDO Manual it's a bit daunting. Is there somewhere I can find a tutorial on the basics of using PDO rather then straight MySQL calls? ...

Pass a value to an inFrame

This probably an easy thing to do but for some reason I can't get a handle on it. I have a simple form that allows people to select one if three items for sale. When they chose their item I need to pass that variable into an iFrame with a third party checkout page to safely process their cc transaction. How would I do this? Cheers- ...

Magento Trying to set the session id to programmitcally add to cart

I have set up a module where I probabilistically add a product to the cart. I swear I had it working but recently found that it wasn't. The background on this is, our client has a third party product that a customer can go to a page on their site, look at the products that this third party has and add an item to our cart. The third party...