php

How to format a getUpdatedAt() kind of date in Symfony?

I'd like to change the formatting of a date in Symfony 1.4 The default one being: <?php echo $question->getUpdatedAt(); // Returns 2010-01-26 16:23:53 ?> I'd like my date to be formatted like so: 26/01/2010 - 16h23 I tried using the format_date helper DateHelper class. Unfortunately the API is rather empty (something really needs ...

Check in C# whether php soap returned soapFault

Hello. I have problem with checking SoapFault response from writen in PHP Soap webservice. Responce looks like this (default "throw new SoapFault("SOAP:CLIENT", "Bad login");" <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt; <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP:CLIENT</faultcode> ...

all links on a page, and how many of these link to the same page again (how can we do that in php)?

I am trying to write a small PHP function that would go through a page (provided a url) and would return the number of links and the number of links that link to the same page. For example, if I provide google.com as a URL it should return how many links are there on google.com and how many links link back to google.com (including of cou...

Example code wanted for Zend_Form_Element_File in conjunction with Zend_ProgressBar_Adapter_JsPush

Hi, I've got a Zend_Form with a Zend_Form_Element_File item which I'm trying to provide a "upload progress" report to the user utilising Zend_ProgressBar_Adapter_JsPush. However, I can't figure out how to do this and I was wondering if anybody with more experience of this section of the Zend Framework could help. The examples on Zend's...

Inserting into mysql database with asian symbols such as ’ —

I cant seem to get these Chinese punctuation marks to work with my database (utf-8) when i do an echo of the query the marks look like this ��� in php i have already done $text=mysql_real_escape_string(htmlentities($text)); so as a result they are not saved into the database correctly what can i do to fix this? Thanks ...

Should I index or store these fields in Solr (or any db) ?

Background: I have a cclassifieds website, and users may for example search for cars, and specify a price range, mileage, fueltype, gearbox and a manually inputted query-string if they like to put something specific into the search, ex "bmw m3". Questions: I am about to move this information to Solr for faster lookup, and wonder if I ...

In PHP, when using PDO with pgSQL how to get the value of "RETURNING" clause in the original INSERT sql query.

In PHP, I am using PDO with the pgSQL drivers. I wanted to know how to get the value of the "RETURNING" clause given in the INSERT sql query. My current code looks like this, $query = 'INSERT INTO "TEST" (firstname, lastname) VALUES ('John', 'Doe') RETURNING user_id'; $queryHandle = $connection->prepare($query); $queryHandle->execute();...

A more pretty/informative Var_dump alternative in PHP?

Every decent programmer has a print_r or var_dump wrapper they use, love and assign shortcut keys to, why don't we share our favourite ones. I am using a simple one, here: function dump($var = null) { static $dumpId = 0; if($dumpId == 0) { echo '<style>pre {margin: 0px; text-align: left; color: #000; padding: 0px; font...

JavaScript not being loaded. Tried everything I can think of...

Hi. Swimwire.com is no longer loading JavaScript properly since I installed an update to its Social module, JomSocial. It's something to do with JomSocial, I'm certain, since on the homepage no JavaScript properly works (there's a blue bar along the top that should be clickable and contain the words 'Open Control Panel', but it doesn't ...

Why do I have PHP code above the doctype?

I'm still learning this stuff, but for the most part, my understanding is that you want code in the head or the body. I'm working with a page that is a login page. Above the doctype is all the php code for the login validation checking and the "root.php" include which is declaring the root of the project, etc. Is this the way things s...

Use PDFLib to search through PDF's with PHP

Hi all, I'm about to rent my own server and for one of my projects I need to be able to search through PDF files. I've asked the hosting provider to install xPDF but they replied they want to install PDFLib instead. My question, am I able to open and search through PDF files with PDFLib? I'm Googling as a madman but I can't seem to find...

How to prepare BLOB in PHP using MDB2 and SQL Server?

So our application supports both MySQL and SQL Server, and we store images in the database. Now the following code works for MySQL just fine, but not at all for SQL Server. I keep getting an "MDB2: Syntax Error". At first, I had the column as an IMAGE and then I changed it to VARBINARY(MAX) and I still can't figure out what's wrong. Any...

PHP Image Magick / Text-to-PNG - many lines & switch fonts inside image-build

Greetings. For a PHP-Project, I have to build PNG-images where I pass some text and then let imagick generate the image for that text. I did this kind of stuff with success in gd, but only had 1 font (per text-generation-block) to play with. As I want to change between 2+ fonts while generating this textblock I read a lot in Google, bu...

Using PEL (PHP EXIF Library), is there a way to remove the embedded thumbnail from an image's EXIF data?

I am working on a project that resizes images using PHP. This project utilizes PEL to copy EXIF data from the source image to the resized image. However, when resizing images to be really small, the embedded EXIF data contains a thumbnail that is actually much larger than the resized image itself. I would love to use PEL to remove this t...

Only allow certain (dynamic) IP's to visit website director

OK I have 4 dynamic ips, in order to get those IP's I need run a gethostbyname('domain_name.com'); on 4 domain names I have that alwasy resolve to the only 4 IP's that are allowed to access this directory. This is very easy for me to do on a PHP script on a page, but I am confused as how I can do it to a directory? Thanks!! ...

Receiving and handling a GET request in PHP

I'm trying to replace RSS polling with pubsubhubbub on my site. I'm able to use the subscriber library that google offers to send the subscription request. From the code it looks like it sends a post request via cURL with the RSS URL and a callback URL. So this is where I need some direction: In order to complete the subscription reque...

How to validate a "date of birth" using 3 select menu's (PHP & Kohana)?

Using the Kohana framework, how would you validate a date of birth given 3 separate drop downs? If an error occurs, only one error should show. ...

prototype-based table sort not working on field with input tags (PHP app)

Hi everyone, I'm struggling with a problem on a web-based application I'm working on where I want to sort on all columns of a page. Every column BUT the one that contains INPUT tags (it is a date column that allows AJAX-style edits and has a little calendar pop-up that helps you choose a date. Is there a way to work around this prob...

Any php code to detect the browser with version and operating system?

I tried to search in google but cannot find a complete solution (i only find something detects only the browser's type like firefox, opera) . i want a php class or code to check the user's Browser including the version and also the operating system. Thanks ...

Filter results in page relating a id-parameter

Hello, I use a SELECT to get all the rows from the table tblnavigation. The rows are: idnav, idnavcat, prognav, progurl $rsnav = mysql_query($query_rsnav, $concat) or die(mysql_error()); $row_rsnav = mysql_fetch_assoc($rsnav); The idnavcat stands for the navigation category. Now i want to filter on that "idnavcat"; and show the resul...