php

Sample twitter App

I am now running my code on a web hosting service http://xtreemhost.com/ <?php function updateTwitter($status) { $username = 'xxxxxx'; $password = 'xxxx'; $url = 'http://api.twitter.com/1/statuses/update.xml'; $postargs = 'status='.urlencode($status); $responseInfo=array(); $ch = curl_init($url); curl_...

virtual directory asp redirector for php app necessary ?

I created a virtual directory for my php app. Now I get the "Directory Listing Denied This Virtual Directory does not allow contents to be listed." Do I need to make some kind of dummy index.asp file that redirects (OR PREFERRED: just displays index.php) or how to solve this? I have restricted access to webserver, but index.php is set...

How to show loading animation before printing buffer content from ob_start()...?

Hi Everyone.... I have a script that runs for quite a while and i am using ob_start() to buffer the output and print the result after the script finishes executing... I need to show some loading animation while the script executes and replace it with the output when the script finishes executing... I know that it can be done quite bea...

How to stop a curl while requesting or stop the running php script?

I using url to request remote urls that sometimes may very slow or just down. In this case, my php scripts still waiting for the response, it makes apache has to many requests stay in memory and then overload. I need a way to stop curl requesting or stop running php script when specified time passed. I'd tried declare(), it makes no sens...

How to troubleshoot memcache set method always fail issue?

I have XAMPP 1.7.3 installed on Windows 7. The PHP version is 5.3.1. I have successfully installed memcache for win32 from http://www.splinedancer.com/memcached-win32. I got PHP extension php_memcache.dll from http://downloads.php.net/pierre. Restarting apache and checking phpinfo() shows memcache is OK. When I test it with below PHP...

Add information through a stored procedure and PHP?

I have a form which contains a lot of elements, my DB guy has generated an SP and now i need to call that stored procedure. My form has twenty elements, when i click on submit the data must be saved in database. I know how to do this on insert query, but how to call an SP and perform this operation. There are 10 tables where the data is...

Save output of a php file in a html file..

I am having a php file which executes some code to generate a html file.Its like I m having a form from which some data will be posted to x.php file, which gives a output(a webpage). I want to save that output in a html file.What the most efficient way of doing this.? EDIT I want to save it on sever side. Actually the thing is i want to...

swfupload destroy session? php

hy, i need a little help here: i use SWFupload to upload images! in the upload function i make a folder call $_SESSION['folder'] and all the files i upload are in 1 array call $_SESSION['files'] after uploads finish i print_r($_SESSION) but the array is empty? why that? this is my upload.php: if($_FILES['image']['name']) { list(...

Is there a PHP library to generate an waveform images out of an audio file?

Maybe something like this exists already? ...

Normalizing (webdav) unicode paths

Hi guys, I'm working on a WebDAV implementation for PHP. In order to make it easier for Windows and other operating systems to work together, I need jump through some character encoding hoops. Windows uses ISO-8859-1 in it's HTTP request, while most other clients encode anything beyond ascii as UTF-8. My first approach was to ignore t...

PHP detecting filesystem encoding

Hi guys, I need to save files with non-latin filenames on a filesytem, using PHP. I want to make this work cross-platform. How do I know what encoding I can use to write the file? I understand many modern filesystems are UTF-8 based (is this correct?), but I doubt Windows XP is (for instance). So, is there a robust detection mechanism...

Is it possible to autoload a file based on the namespace in PHP?

Would what mentioned in the title be possible? Python module style that is. See this example for what I exactly mean. index.php <?php use Hello\World; World::greet(); Hello/World.php <?php namespace Hello\World; function greet() { echo 'Hello, World!'; } Would this be possible? ...

Unit testing file operations - where to maintain mock directory structure?

I'm still new to Unit testing, and specifically PHPUnit as the testing framework. Suppose I'm building a unit test for a resource loader class. The class looks for resources to load in two directories (a global and a user-specific one). To test the class, I would like to set up a mock testing directory containing some resource files. I...

Shell_exec with git pull ?

Hi everyone, I am setting up a github account, to work on a small project with some friends. I would like to have my home machine able to do a git pull via php, so that we just have to call this small php file for the machine to be up to date. As of right now : <?php $output = shell_exec('git help'); echo "<pre>$output</pre>"; ?> T...

i want to wrap the image as well text around the products like mug, t Shirt, crystals

I am working on shopping cart. pls follow the link www.photohaat.com In the mug section whenever the user upload the image i want to wrap the complete image onto the mug so that he/she will saw the final output immediately. we develop this shopping cart on PHP language. I am trying to resolve this problem but unfortunately can't get a...

How do I screen scrape a website and get data within div?

How can I screen scrape a website using cURL and show the data within a specific div? ...

How to get the HTML source code after executing header(location:URL)

Hi My web hosting provider does not permit to use curl FOLLOWLOCATION option so I'm trying to do it manually by using the header function. My problem is that I need to keep my PHP script running and to be able to get the redirected URL data for parsing. How do I do that? ...

Building a CMS in PHP: Development tools

I'm planning to build a CMS in PHP and MySQL, mainly for my own amusement and education. (Though who knows, I may come up with something useful and cool. Anything's possible.) I'll be asking questions about code architecture etc. later. For now, I'm more interested in development tools. So far, all my playing with code has been done on ...

how to run foreach loop with ternary condition

i have two foreach loop to display some data, but i want to use a single foreach on basis of database result. means if there is any row returns from database then forach($first as $fk=>$fv) should execute otherwise foreach($other as $ok) should execute. i m unsing below ternary operator which gives parse error $n=$db->numRows($task...

show the message time in the inbox php

Hi i am doing internal mail service application , i have the field called datetime in my table, i want to show the mail datetim in the inbox view somthing like gmail inbox, i want to show if the mail came just 10 min aga means , i want to show 10min ago, if mail came around 2 days back means i want to show the DATE-Time , Thing ke...