php

regular expression breaking on new line

I'm trying to use a regular expression as below: preg_match_all('|<table.*</table>|',$html,$matches, PREG_SET_ORDER); But this is not working, and I think the problem is the new line inside the string $html. Could someone tell me a work around? EDIT: I've realized that it's not right to use regex to parse HTML. Thanks to those who to...

summing two colums total in mysql

I want a resultset for this table : ID Number_of_posts Number_of_user 1 100 21 2 23 34 as ID Number_of_posts Number_of_user Number_of_posts_AND_Number_of_user 1 100 21 178 2 23 34 178 -------------------------------------...

Setup SVN/LAMP/Test Server/ on linux, where to start?

I have a ubuntu machine I have setup. I installed apache2 and php5 on it. I can access the web server from other machines on the network via http://linux-server. I have subversion installed on it. I also have vsftpd installed on it so I can ftp to it from another computer on the network. Myself and other users currently use dreamweaver ...

postscript to text

I am working on a project to convert OCR'd PDf to png using ImageMagick and ghostscript and display in the browser so that i can select words in the image by letting a user query for the word . Imagemagick works fine along with ghostscript . I have a problem with the ps2text utility where it does not work reliably with pdf's . could any...

DOM manipulation

Hello everyone, Im trying to use the DOM in PHP to do a pretty specific job and Ive got no luck so far, the objective is to take a string of HTML from a Wordpress blog post (from the DB, this is a wordpress plugin). And then out of that HTML replace <div id="do_not_edit">old content</div>" with <div id="do_not_edit">new content</div>" i...

PHP coding a price comparaison tool

Hello, it's the first time I developp such tool you all know (the possibility to compare articles according to price and/or options) Since I never did that i want to tell me what do you think of the way i see that : On the database we would have : offer / price / option 1 / option 2 / option 3 / IDseller / IDoffer best buy / 15$ / f...

Convert base64'd SHA1 hashes to Hex hashes

I have a list of passwords in mySQL that are generated using $hash = '{SHA}' . base64_encode(sha1('some string here', true)); I need to convert these into what would be the equivalent of $hash = sha1('some string here'); As these are password that our mail system uses, and we want to convert to another mail system (but requires th...

Problem with a large CSV file

I have a very large CSV file. 51427 lines to be exact. Is there not a way where I can only read the required lines into an array? That would speed things up significantly. ...

Php alternative syntax highlighting in Notepad++

Is there any way to get tags and the if / endif stuff to highlight like the braces? Search brings me no help. ...

xDebug : Output traces in php script?

Hi! I have tried to use xDebug on my local Ubuntu environment to speed up development and it's a great asset. However, I would like to see the output of the Trace function directly in the browser, at the end of the script. How can this be done? ...

simple authorisation in web api

I want to make nice and clean api; I'm making site and I want to offer the ability to mobile apps use web API of my site. I don't want to use oAuth, becouse the mobile and embedded applications that are facing the biggest hurdle, as they may not be able to bring up and/or control the web browser. Also its a little complicate. I know, t...

How to enable gzip compression using PHP Simple HTML DOM Parser

I have tried a few things to enable gzip compression using PHP Simple HTML DOM Parser but nothing has seemed to work thus far. Using ini_set I've manged to change the user agent, so I figured it might be possible to also enable gzip compression? include("simpdom/simple_html_dom.php"); ini_set('zlib.output_compression', 'On'); $url =...

php reading mysql bit field returning weird character

I am using mysql_fetch_assoc($query), one of the bit field returns out to be , which is supposedly to be true. The problem is that I also need to output this to xml and it's an illegal xml character. the charset for the db table is utf-8. why does this happen? ...

What is method signature in SOAP header?

I want to imitate the following SOAP request using Zend Framework but I don't understand the '__MethodSignature' part in header. Could someone please explain this? <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encodi...

PHP and Gettext don't work on my server

I have a website. I'm trying to get gettext to work so that my English, Sweden and Norway sites can come up. I can't get it to work. What have I done wrong? This is my config code: // define constants ( defualt - danish ) $lang = 'da_DA'; $lang_short = ''; $lang_prefix = 'da'; if ( isset( $_GET['lang'] ) ) { switch( $_GET['lang'...

How can I implement an "interesting tags" feature like that on Stack Overflow?

Check my other question with bounty: http://stackoverflow.com/questions/3436287/finding-similar-number-patterns-in-table I'm trying to implement an Interesting Tags feature. For reference, this is how it works on SO: I add into the "interesting" list my interested tags (like php, mysql, jquery and so on). Then, if any of the display...

Faster way to know the total number of rows in MySQL database?

If I need to know the total number of rows in a table of database I do something like this: $query = "SELECT * FROM tablename WHERE link='1';"; $result = mysql_query($query); $count = mysql_num_rows($result); Updated: I made a mistake, above is my actual way. I apologize to all So you see the total number of data is recovered scannin...

Converting schedule definition into English

Trying not to invent wheels :) and thus I am looking for a way to convert schedule(such as say crontab format) into readable English, much like Google Calendar has. Is there something(preferably written in PHP) that could do that? ...

jQuery + form + textinput > Is it possible to display one value in a textinput and submit another?

I'm working on an application where dates are passed as yyyy-mm-dd but displayed to the client as mm-dd-yyyy (US based client). I'm using a jQuery datepicker for selecting from/to dates in a report and would like to show the dates to the client as mm-dd-yyyy but when the form is submitted, submit as yyyy-mm-dd. Is it possible to displa...

SEO Friendly URL to Dynamic URL using PHP

Currently I have a url like this http://&lt;client_name&gt;.website.com/index.php?function_name&amp;cat=32 I want to set things up so that our Marketing people can publish url's like http://&lt;client_name&gt;.website.com/&lt;parent_category&gt;/&lt;category&gt; The "cat=XX" will be generated of the last <category> only. But m...