php

Open-source parser code for Mediawiki markup

I'm interested in selectively parsing Mediawiki XML markup to generate a customized HTML page that's some subset of the HTML produced by the actual PHP Mediawiki render engine. I want it for BzReader, an offline Mediawiki compressed dump reader written in C#. So a C# parser would be ideal, but any good code would help. Of course, if n...

How to convert imperial units of length into metric?

Here I am faced with an issue that I believe(or at least hope) was solved 1 million times already. What I got as the input is a string that represents a length of an object in imperial units. It can go like this: $length = "3' 2 1/2\""; or like this: $length = "1/2\""; or in fact in any other way we normally would write it. In ef...

Rendering eye-candy bar charts with PHP: tools / best practices

We are using Google Charts for render the chart images, but 500 requests/day became not enough. What PHP classes/frameworks are worth looking at? ...

Best way to parse a dynamic text list in PHP.

I have below a list of text, it is from a popular online game called EVE Online and this basically gets mailed to you when you kill a person in-game. I'm building a tool to parse these using PHP to extract all relevant information. I will need all pieces of information shown and i'm writting classes to nicely break it into relevant encap...

JSP or PHP for Java server components?

I have to choose a server pages technology for a few server components that are written in Java and hosted by Tomcat, like Lucene search service and a flex BlazeDS graphic component. Not sure whether to use JSP or PHP. On one hand JSP can integrate with the components Java API easily while PHP will require another way of integration li...

retrieve email using PHP and pop3 - what is your technique?

I can see some options available: 1) Use PEAR's POP3 class --> tried it, having some weird weird issues like FF choking to death on their sample code!!! 2) Use PHPClasses (here) --> seems to be the viable option at the time, still working on it 3) Write my own or use one of the snippets available The target is currently Gmail, but I ...

Codeigniter - how to reuse code to generate a block of HTML

I think I might be approaching this in the wrong way, so I would appreciate any comments/guidance. Hopefully I can explain coherently enough what I am trying to achieve: I want to create a block of HTML (e.g. a box containing a user's profile), which I will load as part of my layout on most pages that I generate. I would also like to b...

Which is the best way to bi-directionally synchronize dynamic data in real time using mysql

Here is the scenario. 2 web servers in two separate locations having two mysql databases with identical tables. The data within the tables is also expected to be identical in real time. Here is the problem. if a user in either location simultaneously enters a new record into identical tables, as illustrated in the two first tables belo...

best way to obtain a lock in php

I'm trying to update a variable in APC, and will be many processes trying to do that. APC doesn't provide locking functionality, so I'm considering using other mechanisms... what I've found so far is mysql's GET_LOCK(), and php's flock(). Anything else worth considering? Update: I've found sem_acquire, but it seems to be a blocking loc...

How to re-initialize a session in PHP?

Hi everyone, I am attempting to integrate an existing payment platform into my webshop. After making a succesful transaction, the payment platform sends a request to an URL in my application with the transaction ID included in the query parameters. However, I need to do some post-processing like sending an order confirmation, etc. In o...

creating a popupwindow from html, not a file

Hello, I have a php page that displays rows from a mysql db as a table. One of the fields contains HTML markup, and I would like to amke this row clickable and the html would open in a new popup window. What is the best way to do it, and is there a way to do it without writing the html to a file? edit: this php page is actually part o...

cant display image from database outside of table in php

Hello, I have this code <?php session_start(); if (isset($_GET["cmd"])) $cmd = $_GET["cmd"]; else die("You should have a 'cmd' parameter in your URL"); $pk = $_GET["pk"]; $con = mysql_connect("localhost","root","geheim"); if(!$con) { die('Connection failed because of' .mysql_error()); } mysql_select_db("ebay",$con); if($cmd=="GetA...

Why is this regex returning errors when I use it to fish img src's from HTML?

I'm writing a function that fishes out the src from the first image tag it finds in an html file. Following the instructions in this thread on here, I got something that seemed to be working: preg_match_all('#<img[^>]*>#i', $content, $match); foreach ($match as $value) { $img = $value[0]; } $stuff = s...

PHP APIs for Hotmail, Gmail and Yahoo?

Hello everyone, I am a PHP developer who is kind of in a pickle. I'm trying to locate and/or build an API capable of speaking to Hotmail, Yahoo and GMAIL in order to retrieve contact lists (with the user's consent, of course). The one I'm having the most trouble finding is a Hotmail API. Where would I start to look as far as finding ei...

Best language choice for a spam detection service

I have around 20 or so active blogs that get quite a bit of spam. As I hate CAPCHA the alternative is very smart spam filtering. I want to build a simple REST api like spam checking service which I would use in all my blogs. That way I can consolidate IP blocks and offload spam detection to 3rd party such as Akisment, Mollom, Defensio ...

Accessing JS data from PHP

A remote site is supplying a data structure in a js file. I can include this file in my page to access the data and display it in my page. <head> <script type="text/javascript" src="http://www.example.co.uk/includes/js/data.js"&gt;&lt;/script&gt; </head> Does anyone know how I use PHP to take this data and store in it a database?...

php SOAP call over SSL - How do I jam a cert, key, and CA cert together in the request?

So, I'm trying to consume a webservice using something like this: $client = new SoapClient("some.wsdl", array('local_cert' => "cert_key.pem")); I've done this successfully in the past with other web services that required a cert & key concatenated into the local_cert file. Now, I'm trying to consume a service that also relies on a ...

PHP array in object converting to string (so far as I can tell)

I'm developing front-end code for a web application, and ran into an odd piece of trouble with a custom object. When I request the object and use print_r() I get this (the object is a lot bigger; just cut it to the relevant code): MemberInfo Object ( [meta_data] => Array ( [email_recommendations] => true [email_...

Something similar to PHP's SimpleXML in Python?

Is there a way in Python to handle XML files similar to the way PHP's SimpleXML extension does them? Ideally I just want to be able to access certain xml datas from a list object. ...

How do I automatically set a user's locale in PHP?

Is there an easy way to parse the user's HTTP_ACCEPT_LANGUAGE and set the locale in PHP? I know the Zend framework has a method to do this, but I'd rather not install the whole framework just to use that one bit of functionality. The PEAR I18Nv2 package is in beta and hasn't been changed for almost three years, so I'd rather not use th...