php

Find and replace in multiple files

OK, whats the best solution in php to search through a bunch of files contents for a certain string and replace it with something else. Exactly like how notepad++ does it but obviously i dont need the interface to that. ...

Avoid 'waiting for response' in php ?

Hi, I have a php script that uses exec() function to execute curl to download file. The file is about 600mb. So when I acess the php file on a browser, browsers shows me 'waiting for response' message. How do I avoid that? my php source is $a = exec("curl 'http://lab.test.com/test/test/down.php?c=23212' -o 'test.avi'"); ...

Update Twitter status using PHP Form

I have the following code, but it doesn't update my status (the username and password has been removed for this snippet) and it throws the error eeek. Any ideas why it's not working? EDIT: Apparently Twitter NEEDS OAuth instead now. I have been following this tutorial here: http://ditio.net/2010/06/07/twitter-php-oauth-update-status/ ...

raw text storage vs text parsing (BBCODE(PHP))

Im making my little site where users can create blogs, and have studied publishing tools like wordpress and vbulletin. When a user creates a post with BBcodes/mark up language, should i parse it into HTML and insert in db, and then only echo the text for the user, or should insert it with bbcode in the db, and let the php page parse it ...

parsing XML with PHP need to display the embedded HTML as markup

I'm writing a simple atom XML parser with PHP I have trouble displaying the proper content inside the <content> tag if there is additional HTML tag within. Ex. If I want to parse the following XML <entry> <title>Test entry #3</title> <id>http://example.org/article3&lt;/id&gt; <updated>2006-10-03T13:14:34Z</up...

Sometimes the contents load and sometimes they don't

Hi Everyone, I have the script below and on the website http://cacrochester.com, sometimes the contents of the right sidebar load and sometimes they don't. I think it's if it's your first few times on a page, it will say no events scheduled. I'm completely stumped on why this is happening. The data in the database is not changing. Le...

PHP solution to do Google federated login easily?

I see stackoverflow's login system and love the simplicity of clicking one button to log in using Google gmail account. Is there something available for PHP? I know there's solutions out there for Django and others. But would like a PHP solution. Thanks! ...

getting scriptaculous autocompleter to behave like google instant

You know when you start searching in an autocomplete search box, you get a list of possible results. From those results, say you click one of the items on the list, I want to take that item and perform another search to give another list of results. Just exaclty like how google works. if you dont understand me try typing into google sear...

Easiest Google Maps API (javascript/PHP)

I have an array of latitudes/longitudes and Descriptions that I want to display on a Google Map. Does anyone know of an API (or even better a tutorial) that describes a good way to accomplish this or something similar using PHP and/or Javascript? ...

Is there a "right" way to use php?

Hello, I have been learning php, by just plugging away at it. I was hoping someone could point me in the right direction in regards to security, flow and general best practices? Thanks. ...

PHP Notice: Array to string conversion

I have an ecommerce site based off of this tutorial. Now, in the cart.php page, whenever someone updates the quantity and proceeds to click the Update Cart button, they are greeted with the following notices: Notice: Array to string conversion in /home/aquadual/public_html/fiverrproject/plaincart/library/config.php on line 51 Notice: ...

Applying watermarks on pdf files when users try to download the files

Hey guys, the solutions for my schools' assignments all have waterstamps on the pdfs with our username on it. I was wondering if you guys know how to do something like that using php? Do they run a script prior to the download process? Thanks ...

html select php processing question?

i have this select box that users can use to choose an option, but im stuck on how i can process it with php and insert the value in mysql: <select name="vote[]"> <option value="support">I support this</option> <option value="against">Im against this</option> <option value="dont">I want the audience to decide!</option> $insert...

How to handle this error caused by uploading a problematic JPEG?

I have a website where the public can upload JPEGs. Someone from the public was uploading an invalid JPEG that was causing the site to crash for them. PHP said... imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg, libjpeg: recoverable error: Premature end of JPEG file I wasn't sure how to get around this, so I Google...

PHP 2 way security idea

Hi, I had an idea for password security. When a website was generated it would create 2 shuffled copies of all keyboard characters, a random length salt. Further more it would create a random offset number for salt. Example. $password = "Password"; $offset = 3; $salt = "f00"; $saltedPw = "Pasf00sword"; $setOne = 'ftwgDtrE354.....'...

Where do I edit output code to mark-up an image url?

Hello, I have a wordpress site with these two image gallery plugins: http://wordpress.org/extend/plugins/nextgen-gallery/ http://wordpress.org/extend/plugins/nextgen-smooth-gallery/ I want to add some extra markup(for a resizer php) to the image urls, but can't find where in the plugin code to do it. What should I be looking for? Yo...

Object Oriented PHP Arrays

I've never tried OO PHP before so I decided to make a simple CMS to learn more. I am having a problem loading values into a multi-dimensional array. class Article { private $index = 0; private $article; public function Article() { $get_articles = mysql_query("SELECT * FROM `articles`"); while ($result = mysql_fetch_array($g...

What would cause DOMDocument.load to fail loading XML from a URL that is accessible?

$doc = new DOMDocument(); if ($doc->load('http://foo.com/bar.xml')) { // good } else { // wtf happened? } I can wget http://foo.com/bar.xml from the location where the PHP code is running, so I know the URL is accessible. I'm thinking it must be something other than an HTTP error. I'm not sure what else could be causing the failu...

Namespaces on godaddy shared hosting

phpinfo() says that the version is 5.3 and namespaces are activated.. But I keep getting 'Parse error: syntax error, unexpected T_STRING' in the line where the word 'namespaces' appear =s. The script works fine in my local enviroment, I mean I know how to declare a namespace. Of course, they refused to help, and pasted me a link to the...

Should I use formmail or PHP mail?

I recently started working on a web project which was already in progress; the guy who built the foundation for it had the signup page sending the form fields to a formmail Perl script, so that he could get an email when a user signs up. I'm not familiar with Perl, and my inclination is to just use the PHP mail() function and drop the ...