php

Filtering a structure in XML by attribute

I have a nested simple XML structure that I load with PHP's simpleXML. Some elements of the structure contain "context" attributes. <tab context="new_item, edit_item"> <input type="text" context="new_item"> <input type="readonly" context="edit_item"> <tab context="new_item"> ... </tab> </tab> After loading, I need ...

Why is there a "&" in ($arr as &$value)?

$arr = array(1, 2, 3, 4); foreach ($arr as &$value) { $value = $value * 2; } foreach (array_expression as $value) statement foreach (array_expression as $key => $value) statement Does $key mean index of an array? ...

system() not working in php using windows server 2003

hi i have to extract the cabfile(.cab) on the server. i am Finding such script which extract cab file but i didn't get it yet. So now i am try to extract using cabarc.exe. But i face the problem that when i run command throuw commandline its work fine but when i give same command to system() or exec() function in php it is not work. code...

Reading 200 urls automatically with varying intervals between requests

By calling the example URL below my Java servlet caches one file at a time (with corresponding "filekey"). http://www.example.org/JavaServlet?fileKey=phAwcNAxsdfajsdoj&amp;action=cache Now I have 200 files I'd like to cache ... Instead of calling all these URLs manually I'd like to use fopen, curl or something else to automatically go ...

Testing static classes with PHPUnit

Hi, I've got a set of classes I'm trying to test. Class A depends on Class X. Class X contains functions which do random things and things with databases. I've created a mock version of Class X which returns exactly what I want it to in order to test Class A without dependencies. So, my question is, how do I now test Class X as I've a...

PHP's date always returns January?

Hi, I'm writing a sign up form, and I have this: <?php for($j = 1; $j <= 12; $j++) { $month = date("F", mktime(0, 0, 0, j, 1, 2000)); echo '<option value="'.$month.'">'.$month.'</option>'; } ?> The problem is that my select box shows 'January' 12 times, but I want January, February, March etc... through December. How can I fi...

coldfusion decrypt in php

Hello. I'm not english speaker, sorry in advance. I have a ColdFusion 6.1 application, and now I'm trying to migrate to another enviroment. In the ColdFusion application the passwords of my users are crypted with a ColdFusion function: password_encrypted=toBase64(encrypt(text,key)); any one knows how can I decrypt it in PHP? I don't k...

Serving a json file for IPHONE app

I am trying to get an introduction to serving files to the iphone. I have watched tutorials on getting files from sites like Flickr and twitter. I need a tutorial to show me how to set up the site that is feeding that information. Most of those sites send you a json file. Can I just keep a dynamic file on a server using php? ...

PHP absolute path to file URI

In order to refer to a local DTD when using PHP SimpleXML, I need to convert the absolute path into a file type URI. For example, convert /home/sitename/www/xml/example.dtd to file:///home/sitename/www/xml/example.dtd. In the example given, it is easy enough, since all that is required is to add the 'file' scheme in front of the path. ...

How to print out the keys of an array like $_POST in PHP?

Maybe the code looks like something like this: foreach(...$POST){ echo $key."<br/>; } ...

Drupal section accessible by role.

I need to limit access of content on Drupal site based on the Drupal User's Role. http://site.com/managers/intro http://site.com/managers/reviews http://site.com/managers/up-for-raises The content can be of multiple content types and isn't limited to one specific content-type. These content types will be used elsewhere on the site s...

How to handle Facebooks new UID sizes?

I've been working a little bit on a Facebook application, but when I registered a new user to test the friend interaction the new user got a uid (100000XXXXXXXXX) that seems to big for php to handle. Saving the number in the database results in the same value (2147483647). I'm guessing this is also PHPs fault, as I would believe the ui...

Drupal shared tables, but from another database

I have a Drupal Multisite set up with hundreds of sites. I want to make some tables shared (like banners, and roles) so I don't have to update hundreds of sites when changing a banner (for example). I know this can be done using these strings in settings.php: $db_url = 'mysql://user:pwd@localhost/example_db'; $db_prefix = array( ...

php - how to display values from a SimpleXMLElement

how do i display individual values from the following code? SimpleXMLElement Object ( [@attributes] => Array ( [stat] => ok ) [profile] => SimpleXMLElement Object ( [address] => SimpleXMLElement Obje...

CURL / screen scrape delivery tracking details from Canada Post

I need to obtain delivery tracking details from the Canada Post website, which does not offer an API. I've formulated a URL that when entered into a browser correctly returns the tracking information, but I can't get the request to function with CURL (it returns a 500 We're Sorry page). class cURL { var $headers; var $user_agent; v...

PHP - Mulilingual application design

There are many ways to design a multilingual application in PHP. Some language file based, others database based. I am looking to use it for mostly small amounts of text e.g errors - at most a paragraph. I guess I will need twenty or so languages. Really I am looking for recommendations rather than a definitive answer. What have you ...

Real Estate - Property Website - Using PHP - Any Suggestions?

Hello, I had an enquiry from a potential customer who would like to build a Real Estate website. He was looking to provide access to Agencies who can list their properties and add images and details to it. I know that Joomla with Mosets Hot Property can handle this well. I do not want the complex CMS behind a property management websit...

What does this DB error mean? (in AMember with VBulletin)

Vbulletin3 plugin error: DB - [] - incorrect value. Error: Table 'my_db.user' doesn't exist (where "my_db" is the name of my database). I'm trying to integrate VBulletin with AMember Pro. I've bought licenses for both. Each has their MySQL database and user (with full privileges). Each has the integration plugin for the other. Bu...

wordwrap + nl2br = more than you need line breaks?

I have a textarea inside a form. No wrap in the html code is provided. In the php file (forms action=phpfile.php) I get the value of the textarea like so: $ad_text=wordwrap(nl2br($_POST['annonsera_text']), 47, '<br>', true); echo $ad_text; Then the output is: hellohellohellohellohellohellohellohellohellohe llohello. hi. hi. hi. /> h...

web-based project management and time keeping software?

I work in a web shop where most of us aren't programmers. (I am.) Structure is almost non-existent. The biggest beauracratic construct is logging our time since that is essential for business. A few of us are project managers but everyone has their own system. Now lately customers want estimates for all of our work and reconciling t...