php

How do I convert 'Apr9,20037:33am' to a unix timestamp?

I have a date in this format: Apr9,20037:33am How do I turn into a timestamp? ...

Which is the event listener after doSave() in Symfony?

Hi, I've been looking at this event-listeners page http://www.doctrine-project.org/documentation/manual/1_1/pl/event-listeners and I'm not sure which is the listener I have to use to make a change after the doSave() method in the BaseModelForm.class.php. // PlaceForm.class.php protected function doSave ( $con = null ) { ... parent:...

PHP StdErr after Excec()

In PHP i am executing a command with exec(), and it returns if successful an URL; $url = exec('report'); However, I want to check STD_ERR, if something went wrong. How would I read the stream? I want to use php://stderr, but not sure how to use it. Thanks, Martin ...

How do I enable PDO using CentOS?

When outputting phpinfo(); I can see that PDO is set to '--disable-pdo' in the Configure Command section. How can I enable this using SSH? ...

Simple code? PHP script pulls update.zip from central server and extracts it to local folder!

Can someone post code or point to a working example of a php script that opens a known zip file located on a remote server (via http) and extracts the contents of that zip file to a folder on the same server as the calling script? Server A calls out for zip file located on Server B Server B sends the zip file over to server A Server A e...

Detecting json_decode() failure in PHP

When using PHP's json_decode(), I don't see a way to distinguish between a NULL return value indicating a failure in decoding and a correctly decoded NULL value: var_dump(json_decode('nonsense')); // returns NULL var_dump(json_decode(json_encode(NULL))); // also returns NULL And case one doesn't throw an exception. So I'm not sure how...

Replace newlines with br but ignore newlines after h1 in PHP

Is it possible to replace newlines with the br tag but to ignore newlines that follow a </h1> tag? So for example I want to change this block: <h1>Test</h1> \n some test here \n and here To this: <h1>Test</h1> some test here <br /> and here Thanks. ...

Better way to send bulk mail using PHP without PEAR Mail and 'mail' function

What script, class or function you use to send many emails, excluding the in-built 'mail' function and excluding the PEAR Mail (many problems and compatibility issues in PHP 5.3). I want to send about 5000 emails per 'shot', but 'mail' function connect and disconnect for each email. PEAR Mail have many problems. I've tried Swiftmailer,...

Are abstract class constructors not implicitly called when a derived class is instantiated?

Take this example: abstract class Base { function __construct() { echo 'Base __construct<br/>'; } } class Child extends Base { function __construct() { echo 'Child __construct<br/>'; } } $c = new Child(); Coming from a C# background, I expect the output to be Base __construct Child __construct...

CSVs without quotes not working with fgetcsv

I'm trying to parse CSV files uploaded by the user through PHP, but it's not working properly. I've uploaded several properly formatted CSVs and it worked fine, however; I have many users trying to import CSV files exported from Excel and they are having problems. I've compared the files to mine and noticed that the Excel files all lack...

What pitfalls should be noted when moving from C# to PHP?

So, I just stumbled across this one in another question: Parent constructors are not called implicitly if the child class defines a constructor. What else should one be aware of when writing code in PHP from a C# background? ...

Using PHP to recreate something similar to VistaPrint / CafePress / Zazzle. Any Ideas?

I am working on a website in which the client wishes to have users upload background images to a printable design, crop to size, add text. Do this to multiple pages then generate a pdf of the 'book' I am running into the following issues/questions and just need to see where I can start Are there any PHP developer packages that can do ...

using getHtmlSource in Selenium after following a link on the initial page

I opened a page and am following a couple of links with the click() method. $this->selenium->open("test.html"); $this->selenium->click("link=testlink1"); $this->selenium->waitForPageToLoad("10000"); $this->selenium->click("link=testlink2"); $this->selenium->getHtmlSource(); Now I want to get the HTML source of the current page that I...

Cookie across HTTP and HTTPS in PHP

How can I set a cookie in PHP that is readable both in HTTP and HTTPS? If this isn't possible, what can be done? Set two cookies? ...

PHP mail not working in one script, but does in another

I have a small php mailer script within a php file that works fine and sends mail fine: $subject = "subject"; $mail_body = "mail body"; $name = "noreply"; $email = "[email protected]"; $recipient = "[email protected]"; $header = "From: ". $name . " <" . $email . ">\r\n"; mail($recipient, $subject, $mail_body, $header); However, if...

Create a nag alert (update available!) checker script

I have a remote updater script that resides in my wordpress theme folder. The script simply calls out to the central server and grabs a zip file which contains the latest updated files for the theme. I'd like to enable a nag alert checker that executes whenever the theme's options panel is accessed and I'm just brainstorming it here for...

How do I continuously pass values from PHP to javascript

Hello, I need to update my UI (webpage) periodically with new values. I have PHP code that grabs the values form a database, but I am not 100% sure on what is the best way of getting that data to the UI side. The complication here is that: 1. I need to constantly update the values (every second) 2. I need to update many different areas...

PHP & MS Access 2007 on Shared Linux Hosting

Basically I work for a dining services company that has a menu database that we use for each week at multiple locations stored in a Microsoft Access 2007 .accdb file. I'm trying to develop a PHP application on shared hosting so that the .accdb file can be uploaded and queried as to generate and store HTML menus for the week based on the ...

Help with Array and Post

I have this form: <form action="" method="post"> <label for="color">Color:</label> <input type="text" style="width: 195px;" name="color" id="color" value="<?php echo $item; ?>"> <input value="Save" type="submit" /> </form> And the following PHP to capture contents: if (!empty($_POST['color']) && preg_match('/^#[a-fA-f0-9]...

PHP Proxy Script for Indirect Browsing

I'm looking for a PHP script that I can install on my own server that allows indirect HTTP browsing with my server as a proxy. I want it to automatically convert all tags within document to redirect to my server as well, so that once I'm on a site, I can still click through any of the links and see all images. In the past I've used htt...