php

HTTP Post headers, received differently from what's being sent

HI I'm tring to send some headers in my PHP script such as $headers[] = "BATCH_TYPE: XML_SINGLE"; $headers[] = "VENDOR_ID: 56309"; But they are being received as: Batch-Type Vendor-ID ..not as they were intended or required - which is causing me problems. Anyone know why or how to sort? Thanks, <?php function httpsPost($Url, $...

Performance considerations of JSON vs. XML

I am using a webservice which provides a large result set either in XML or JSON format. Which format will be faster or better (perfomance based)? Also which language should I use to parse the XML/JSON? Should I use PHP or JavaScript? ...

run php script from command line with variable

I want to run a php script from the command line, but I also want to set a variable for that script ie. Browser version: script.php?var=3 Command line: php -f script.php (but how do I give it the variable?) PS. doesn't matter if it's a GET variable or not, I just used that as an example. ...

PHP OO retry logic implementation and passing dynamic method and args

Hi all, My first question here. The question is similar to this one: http://stackoverflow.com/questions/712161/php-retrying-a-query-a-set-number-of-times-or-until-success Try till success in OO way. Here example what i'm trying to do: class Creatives { public function run() { $auth_token='mypassword'; $id=123123; $this->retry_til...

Using modules in ZendFramework 1.8.2

I'm trying to use modules in the ZF 1.8 project but can't get working routing to modules' actions. Here is an example, I create route "/test" that points to module 'test', controller 'ttt' and action 'index': $router->addRoute( $name, new Zend_Controller_Router_Route('test', array('controller' => 'ttt', 'mo...

good stand-alone svn client

Hi - I'm currently working with partner on a PHP project. We both edit directly to a local server (all files are stored on the server, which is also running a WAMP stack). I'm looking for an SVN client that will monitor and save all changes to the htdocs folder, and will update a remote SVN repository, through the web. It would be a g...

USING webservice in PHP which returns XML

I am using a webservice to get some results in XMl form... here is the part of the code public function getXML() { $url=$this->constructURL(); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $xml = curl_exec($ch); if ($e...

Adobe flex maximum size of uploaded file

Is there a maximum size limit for files being uploaded in Adobe Flex? I am testing it on localhost and can't upload a file of roughly 300MB. Even though I receive the complete event, after I upload the file.... I was able to upload a file of roughly 10MB. I am using PHP on the server side. ...

How to refactor this conditional to avoid repetition?

This is part of an events page that can be filtered by date (using pre-defined date ranges or a date picker). I want to avoid repeating the whole foreach ($days as $day_number)... etc. loop for every condition. I guess that whole loop could be moved to a function, but I'm not sure how to implement it. <?php // open the db connection ...

Phing and Wordpress configuration

Hi! I'm using Phing to push a wordpress installation to my production server. Is it possible to define the wp-config properties inside my build file, and then have phing replace the wp-config contents to use those variables? Like this: <property name="prod.db_name" value="wordpress" /> <property name="prod.db_user" value="root" /> <pr...

avoiding MySQL injections with the Zend_Db class

Hi - I currently use Zend_Db to manage my queries. I've written already code that preforms queries like the one below: $handle->select()->from('user_id') ->where('first_name=?', $id) ->where('last_name=?', $lname) I've done this without sanitizing the input, assuming Zend_Db will. Does Zend do th...

JSON save in Database and load with JQuery

I create a huge JSON-Object and save it in my database. But when I load the "string" and echo it in PHP, I can't access the JSON Object in JQuery. Do I have to consider something if I want to save my JSON Object in a MySQL Database (when I just create the Array and then echo it with "echo json_encode($arr);" it works fine, but I need to ...

How can I optimize this simple PHP script?

This first script gets called several times for each user via an AJAX request. It calls another script on a different server to get the last line of a text file. It works fine, but I think there is a lot of room for improvement but I am not a very good PHP coder, so I am hoping with the help of the community I can optimize this for speed...

Using SEO-friendly links

Hi I'm developing a PHP website, and currently my links are in a facebook-ish style, like so me.com/profile.php?id=123 I'm thinking of moving to something more friendly to crawling search engines (like here at stackoverflow), something like: me.com/john-adams But how can I differentiate from two users with the same name - or more ...

Pretty URLs without mod_rewrite, without .htaccess

Without a possibility to access .htaccess I find myself in a creative impasse. There is no mod_rewriting for me. Nevertheless, I want to be able to do the nice stuff like: http://www.example.com/Blog/2009/12/10/ http://www.example.com/Title_Of_This_Page What are my alternatives? In respond to the answers: I'm building with php5 I ...

HTTP Digest authenticating in PHP

I want to authenticate to another site using HTTP Digest authorization in PHP script. My function has as parameter just content of the WWW-Authenticate header and I want to generate correct response (Authorization header). I have found many examples that explain how to implement this the other way (browser authenticate to my script) but...

How do you determine which timezone is at 12am right now?

I am working on a cron job which sends report to hundreds of users around the world. The cron should send an email to all my users at exactly 12am in the morning according to their timezone. Thanks in advance ...

Are there any demerit if I use JSON as the storage mechanism, for storing ID/password information ?

I asked for PHP login system and I got answers, lots of files tactics * aaa.txt(content is aaa-pass) * bbb.txt(content is bbb-pass) * and scandir. XML CSV MySQL SQLite PEAR::AUTH But no one mentioned about JSON. but I feel JSON is the best way for me. Because it looks easy , and PHP has JSON dedicated built-in fun...

Need some advice on error handling in PHP / mysql

I'm not sure which method is best to use when giving READABLE feedback to end user. I've read some forums, but not really gotten any wiser (or I have not understood it) I would like to give feedback when insertion / update fails, when it's a success and when giving custom feedback (like checking if an item alread exists). On INSERT, UP...

using apache's mod_rewrite to parse SEO friendly URL's

Hi - How do I convert something like me.com/profile/24443/quincy-jones to me.com/profile.php?id=24443 or something like me.com/store/24111/robert-adams to me.com/store.php?id=24111 with mod_rewrite? Can I make the reverse conversion as well with mod_rewrite, or would I have to parse it through PHP? ...