php

Help merge 2 arrays and sort by key

I am having some trouble with a basic php issue and want to know if anyone can help me out. Basically I need to combine the results of 2 queries, and merge the arrays based on the key, while retaining the 1 key to 1 value that is present in both queries. For example: "select * from table 1, table 2 where table1.id = table2.id"... ma...

How to set read only flag on streamed content from web server

Is there a way include or suggest a read only flag as part of a content-disposition: attachment; filename=document.doc or other http header? ...

Accessing Sabre Web Services using PHP

I have been approached to create a website using Sabre Web Services to power the reservations system. All documentation I have seen refers to .NET or Java solutions, I was in doubt whether PHP can be used as access is performed using SOAP. I have found no further information about this, I assume the answer is yes, but wonder why there is...

How can I send data with PHP to an IP address via UDP?

How can I send data with PHP to an IP address via UDP? How can I recive that data on the other computer? <?php $fp = pfsockopen( "udp://192.168.1.6", 9601, $errno, $errstr ); if (!$fp) { echo "ERROR: $errno - $errstr<br />\n"; } socket_set_timeout ($fp, 10); $write = fwrite( $fp, "kik" ); //$data .= fread($fp,9600); //echo "$data...

How can i get a wildcard list in a CakePHP scaffolding?

I've got a scaffold built for CakePHP, but need to have a way for users to type in part of a surname into a text box, click a button and for the list of people to be filtered to a wildcard search. I'm struggling for example code. Does anyone have some? ...

Who can crack this twitter regexp?

I would like to grab all the hashtags using PHP from http://search.twitter.com/search.atom?q=%23eu-jele%C4%A1%C4%A1i The hashtags are in the content, title nodes within the RSS feed. They are prefixed with # The problem I am having is with non-English letters (outside of the range a-zA-Z). If you look at the RSS feed and then view th...

RegEx for replacing and adding attributes to an HTML tag

Given the following code : <body> <img src="source.jpg" /> <p> <img src="source.jpg" id ="hello" alt="nothing" /> <img src="source.jpg" id ="world"/> </p> </body> What's the best way - using a regular expression (or better?) - to replace it so it becomes this: <body> <img src="source.jpg" id="img_0" /> <p> <img ...

Generating reports from MySQL tables

Let's say you have a bunch of MySQL tables, and you want your end users to be able to generate reports with that data with a PHP script. You can present the field names from those tables in a dropdown, so a user might be able to say, "first_name equals John." Great. But what if you want those field names to be a little more readable? For...

Offsite media streaming setup

I've got a media-rich site that's going just beyond the what our server can handle in terms of storage. Estimate between 500 gigs and 2 terabytes. The media is uploaded through the website usually 500k to 30 megs at a time and are just videos and photos users have uploaded. Using the PHP FTP functions the media is then copied from the...

PHP Redirect Without Modifying Headers

I have a PHP script that is redirecting the user via some code like: header ('Location: http://someurl/somepage.php'); Then in somepage.php I am trying to access $_SERVER['HTTP_REFERER'] to determine where the page request has come from. I find that $_SERVER['HTTP_REFERER'] is empty when a page is called using the header location meth...

$_GET updated_value(?) - Another In-Place Editor(Jquery Plugin) question.

Hi all, Using PHP, and MySql, I am trying to implement this rather snazzy in-place editor available here: tutorial: http://www.davehauenstein.com/code/jquery-edit-in-place/ js file: http://davehauenstein.com/code/scripts/jquery.inplace.min.js OK what is happening is, I click the element to edit the text. I clear the old text, and e...

Adding an array formula to an Excel spreadsheet using PHP

I'm generating an excel spreadsheet using the PEAR extension, Spreadsheet_Excel_Writer. I need to add an array formula to one of the cells, but all the info I've read about them only discusses them as if you're in the Excel program itself: it says you have to type in the formula as normal and then press Ctrl+Shift+Enter to switch it to a...

Most efficient way to convert a ISO Date into Unix timestamp?

In my application, I have some records which I need to filter based on some time parameters. To do the date comparisons, I need to convert the dates in my records (a string in the format YYYY-MM-DD), to a unix timestamp (seconds since 1970). Since I have many thousands of records, I really want to find the most efficient way to do it. A...

How to Make sure the code is still working after refactoring ( Dynamic language)

How to make sure that code is still working after refactoring ( i.e, after variable name change)? In static language, if a class is renamed but other referring class is not, then I will get a compilation error. But in dynamic language there is no such safety net, and your code can break during refactoring if you are not careful enoug...

How can I delete and edit a specific node within a XML file by using php?

How can I delete and edit a specific node within a XML file by using php? please healp me anybody!! ...

PHP4 session / object problem

I have a weird problem with PHP4 I have a class which assigns a $_SESSION variable. On the local dev server it works as: $_SESSION['foo'] = $this->foo; and I can access $_SESSION['foo'] as a string. on the live server $_SESSION['foo'] is not a string but a serialized object? the same code? ...

Text on a image

Is it possible to dynamically place text on an image in php? And then send it to an rss feed? ...

Apache on windows server can't write to file

We have installed Apache 2.2 on a windows server 2003. We want to make apache able to write to files on the disk but we don't know as what user Apache works as. How do we allow Apache to write to files on a Windows server 2003? BR Larre UPDATE: The user is running as 'SYSTEM' and we have tried giving that user full permission to all ...

json_decode returns NULL (php)

There is a strange behaviour with json_encode and json_decode and I can't find a solution: My php application calls a php web service. The webservice returns json that looks like this: var_dump($foo): string(62) "{"action":"set","user":"123123123123","status":"OK"}" now I like to decode the json in my application: $data = json_dec...

mysql split multiquery string with php

I want to make a database restore function that will parse a dump made with Php My Admin and will do the queries. I have already a mysql class that does the query, but it only knows to do a single query. So i am looking of a way to split the file content into single queries. I tried to play with preg_split ... but didn't managed to get...