php

Regexp: Remove no alnum chars from a string

Hello, how could I remove all characters from a string that aren't a-z/A-Z and 0-9 and _ with PHP? I tried that but it has no effect, it returns the same string back: preg_replace('[^a-zA-Z0-9_]', '', 'Testdo123_-:=)§%&'); ...

What is linux equivalent of running a .bat file on windows from PHP using system()

I have a PHP script that runs a .bat file on my windows machine using $result = system("cmd /C nameOfBatchFile.bat"); This sets some environmental variables and is used to call Amazon EC2 API from the command line. How do I do the same from a Linux server? I have renamed my .bat file to a shell (.sh) and changed the script to use 'ex...

Possible relationship between PHP Mailer and Mailer-Daemon

Hi, I am using the PHPMailer Class from a website which sends confirmation of the user ajax upload to my client. This uses the mail.myclient.com SMTP Host. This is the same SMTP Host that my client uses for his outlook to check his emails. This email from the website gets sent without errors although I have received two emails from my ...

Can a Jquery Ajax Call Accept an Object on Succes from PHP?

I'm writing a simple ajax function and looking to populate two text input fields with the 'success' results. I'm wondering what my php syntax has to be to return an object. Here is my Javascript function function editModule(a){ data = {moduleNum:a} $.ajax({ type: 'POST', data: data, url: 'includes/ajaxC...

Name and parameters of parent function

I'm trying to figure out how to get the name and parameters of a parent function. Example: function foo($a,$b){ bar(); } function bar(){ // Magic Print } foo('hello', 'world'); Output: foo('hello','world') Any tips? ...

generate php code from wsdl

I have a bunch of webservices that I need to write PHP clients for. Now I can manually write wrappers for each of the WSDL files but i wanted to see if there is a tool that can help me by generating the wrappers in PHP. Any idea if there are any tools that do this? Thanks ...

Get root node of XML doc using simplexml

Using simplexml_load_string() how do I get "ForgotPassword" from the following XML? <?xml version="1.0" encoding="utf-8"?> <ForgotPassword> <version>1.0</version> <authentication> <login>username</login> <apikey>login</apikey> </authentication> <parameters> <emailAddress>[email protected]</emai...

PHP: Adding arrays together

Could someone help me explain this? I have two snippets of code, one works as I expect, but the other does not. This works $a = array('a' => 1, 'b' => 2); $b = array('c' => 3); $c = $a + $b; print_r($c); // Output Array ( [a] => 1 [b] => 2 [c] => 3 ) This does not $a = array('a', 'b'); $b = array('c'); $c = $a + $b; pri...

Integrating Incoming Email Into a php/mysql App

I am looking to create an incoming email daemon switchboard that I can integrate with various remote php/mysql apps. Ideally I want to check the 'to' address to see if it is in a mysql database and if it is, have the email parsed and posted via CURL to a target destination as well as have attachments saved somewhere locally. I will like...

PHP Image Upload object won't create directory on windows

I'm writing a class that excepts a product_id and a $_FILES array as it's constructor. The class saves these variables and uses them to create a new directory named by product_id and attempts to copy the temp file to my specified directory. For some reason my class isn't even getting as far as creating a directory (which should happen ...

How do I copy a JavaScript object into another object?

Say I want to start with a blank JavaScript object: me = {}; And then I have an array: me_arr = new Array(); me_arr['name'] = "Josh K"; me_arr['firstname'] = "Josh"; Now I want to throw that array into the object so I can use me.name to return Josh K. I tried: for(var i in me_arr) { me.i = me_arr[i]; } But this didn't have ...

How do I generate site map from MySQL database

Hi all I am new to Php and working on a project which needs to generate sitemaps from URLS which stored in MySQL database. how can I do this?? Is there any one have any idea?? site maps can be in php extension too and only requirement is list of sites display in each page ...

Join Query Help

Hello, The query below works well. It pulls data from two MySQL tables, "submission" and "login." I would like to also pull data from a third table called "comment" in the same database. The table "comment" has the following fields: commentid, loginid, submissionid, comment, datecommented Two of the fields in the table "login" a...

Problem creating a webpage in OOP pattern?

I want to develop a website in OOP pattern, but I am stuck in a point whether I need to inherit from multiple classes. For example I have a main class "index" this class has several methods which need to inherited from other classes and I have created seperate classes for it like class "banner", class "content", class "footer" Not o...

Why can’t PHP script write a file on server 2008 via command line or task scheduler?

I created a question on serverfault.com, and it was recommended that I ask here. http://serverfault.com/questions/140669/why-cant-php-script-write-a-file-on-server-2008-via-command-line-or-task-schedul I have a PHP script. It runs well when I use a browser. It writes an XML file in the same directory. The script takes ~60 seconds to r...

How to use PHP fgetcsv to create an array for each piece of data in csv file?

I'm trying to import data from a csv file to some html code to use it in a graph I have already coded. I'm trying to use PHP and fgetcsv to create arrays for each separate piece of data to use PHP to put it into the html code. I know how to open the csv file and to print it using PHP, and how to print each separate row, but not each piec...

Parsing raw apache logs

I need some php code for parsing raw apache logs. In particular, I want the number of times mode=search and the term used for searching. Here is an example: 207.46.195.228 - - [30/Apr/2010:03:24:26 -0700] "GET /index.php?mode=search&term=AE1008787E0174 HTTP/1.1" 200 13047 "-" "msnbot/2.0b (+http://search.msn.com/msnbot.htm)" 212.81.200...

has anyone actually used sapphire framework from silverstripe?

I was looking for a good lightweight framework for php development, I saw symfony, cake, and CI, and found sapphire from silverstripe and I was wondering if anyone has actually used it or if it is just a scam for using silverstripe. Your comments are very appreciated. ...

Removing an element from an array (PHP)

I want to remove an element from a PHP array (and shrink the array size). Just looking at the PHP docs, it seems this can be done using array_slice() and array_merge() so I am guessing (off the top of my head) that some combination of array_merge() and array_slice will work. However, array_slice() requires an index (not a key), so I'm n...

PHP & MySQL pagination display problem.

I asked a similar question like this yesterday but after waiting for ever I figured out part of the problem but now I'm stuck again I'm trying to display ... when the search results are to long because my pagination links will keep on displaying and will not stop until every link is displayed on the page. For example I'm trying to achi...