php

Adding/Removing cron job using PHP

Here's my situation: We have an outside provider that will be pushing XML files to our server every 30 seconds at a specified time in the week.  That time will vary each week. So, I would like to give my users an interface on the management side of our site where they could "push a button" and trigger the capturing of data. (and in the s...

Why does my localization cookie seem to not want to change?

Why cant I change cookie? If you chose a language you cant change. You have to empty your cookies if you want to change language. Why is that? if (isset($_GET['setLang']) && $_GET['setLang'] == 'en' || isset($_COOKIE['setLang']) && $_COOKIE['setLang'] == 'en') { setcookie("setLang", 'en', time()+(3600*12)); //expires in 12 hours incl...

Should I write a component or a module? (or both?)

I'm trying to write a slideshow for joomla. Specifically one that will be placed next to an article (no necessarily associated with the article though). Should i write a component, or a module? OR should I write a component that is placed in the page using a module (like the com_banner and mod_banner stuff in the joomla basic installatio...

Has anyone succeeded at downloading orders from Amazon Seller Central using PHP?

It looks like this question has been asked before, here and in other places on the web, but I have yet to find any solid documentation on how it's done. We need a way to pragmatically "suck" orders out of Amazon Seller Central on a regular basis, and insert the data into a database on our server for processing. There's hints that you ca...

Is there any PHP Framework written as a C extension?

Yes i know Zend, Cake, Symfonie, Kohana and CodeIgniter. But i would like to know if anyone has ever tried to get rid of the huge overload you get by writting core components in php and tried to factor as much stuff out into an extension. Precompiled router classes, caching (modules have a build in memcache), etc. could speed things up....

why use curl instead off other methods

Hello, I would like to know why it is better to use curl instead off other methods like $ret=file($url) in php. This is actually used to access an http api for an sms gateway/ Someone dropped a "I would recommend using curl for http connections", but I don't know why I just read that it is neccasary for paypal payments, so that does ...

Social Networking APIs for PHP

Good Morning SO Campers, I'm interested in developing a social networking site. It will be run on a Linux dedicated server and must be written in PHP. The site functionality will be a cross between FaceBook, Myspace and Yahoo. Specifically, the site needs to offer: The ability for users to obtain a free email address. Instant Messag...

Geo conversion with php

I would like to convert a lat/lng string to decimals in php. An example: N47° 30.5951' = 47+(30.59517/60) = 47.509918333 Is there any easy way to do that, regular expression? Thanks ...

PHP variable variables in .NET

Does .NET natively support anything similar to PHP's variable variables? If not, how1 could such a feature be most easily implemented? 1 If you think variable variables are always bad, feel free to state your case but the main question is: how can they be implemented? ...

How do you use PHPUnit to test a function if that function is supposed to kill PHP?

Essentially I have a method of a class called killProgram, which is intended to send a hTTP redirect and then kill PHP. How am I supposed to test this? When I run phpunit it doesn't return anything for that test, and closes completely. Right now I'm considering having the killProgram function throw an exception which shouldn't get hand...

Session handling in PHP

What is the best & most secure way you've handled sessions in a PHP application? I want to know the best, most robust and secure method there is. :) ...

linux file size

hi i am using this exec("du -sh -S ".$fileFlv.""); command in php to get size of a file all the things works fine but the problem at my end is i want only the size but it dispalys the size as well as name of the file ...

Validating XML from Twitter

When I receive XML data (via a Twitter API call, in this instance), I imagine it's best practice to somehow validate it before I begin working with it? My app has had a lot of untractable issues lately, and I want to rule out bad XML data. Does XML ever go "bad" somehow? Would an overloaded server like Twitter's ever spit out just half ...

Order by null first, then order by other variable

Hi, this is my code for now: SELECT id, number FROM Media WHERE user = 10 ORDER BY id, number but I want it to look like: SELECT id, number FROM Media WHERE user = 10 ORDER BY while(number IS NULL), id What I want to do is to have all number that are NULL on the top of the result, but as soon number is not NULL, sort by id Is that...

Get seconds until end of day in PHP

Hello, In PHP, how can I get the number of seconds until the end of day? Thanks. ...

Unpredictable log file writing in PHP

Hi there. I have a script that runs every two minutes for a "Tweet-getter" application. In a nutshell it puts tweets onto Facebook. Every now and then it hiccups and despite my error checking, reposts old tweets continuously, every two minutes (the cycle of it being run as a cron job). I have a log.txt that in theory would help me determ...

PDO and nested fetching

Let's say I have something like this: $db=new PDO($dsn); $statement=$db->query('Select * from foo'); while ($result=$statement->fetch()) { //do something with $result } How would I put another query inside of that while loop? Even if I make a new PDOStatement object, it seems that that overwrites the cursor for the topmost PDO s...

suggestions for a html designer for the php eclipse package

I'm using an eclipse installation I downloaded mainly for PHP development. Now I want to add a HTML visual desiger. Any suggestions? I'm an eclipse newbie. ...

php libcurl alternative

Are there any alternatives to using curl on hosts that have curl disabled? ...

How does PHP communicate with MySQL on the same server

Hey! Does anyone know how php requests data from mysql? If I have mysql in the same machine as php, does it open a tcp connection to the localhost on port 3306 or does it have some other way of getting the data? Is it the same in linux and windows? Thanks ...