php

PHP Server settings causing problem

Hello, On my site http://www.mediadeals.co.uk , I'm getting this strange error. The site was working perfectly well a week ago on the old server. The error is: Fatal error: Cannot redeclare class soapclient in /home125b/sub013/sc71724-JPYM/www.mediadeals.co.uk/www/includes/libs/payment/do_payment.php on line 5261 I'm sure i...

Word automation issue with PHP

I've been trying to automate opening and populating a Word file on network but came across an issue when trying to open the file from a mapped network drive. I can open the file from my c:\ drive and I changed the Apache settings to run as a user rather than as a local service. The script runs perfectly well in the Zend environment doing...

Server side SQLite database with Google Web Toolkit or JQuery

Hi all, I have a large array of vehicle make and model data that I want to dynamically display on a web page. For example, when you select a vehicle make from a drop down menu the vehicle model dropdown is dynamically populated with an asynchronous call. I would normally execute this with an AJAX call to a PHP script that would return ...

how locale aware is preg_replace in php?

If I do, preg_replace('/[^a-zA-Z0-9\s-_]/','',$val) in a multi-lingual application, will it handle things like accented characters or russian characters? If not, how can I filter user input to only allow the above characters but with locale awareness? thanks! codecowboy. ...

Consuming .Net web service from PHP - how to debug

I'm using PHP5 integrated SOAP Client. My web service method accepts around 30 parameters from string and int to bool and double. Upon calling the method I get the following error: Fatal error: Uncaught SoapFault exception: [soap:Client] Server was unable to read request. ---> There is an error in XML document (3, 983). --...

Why can't I round-trip from .png image to base64-encoded, back to .png image w/ PHP?

First quesiton on Stack Overflow, so please be gentle. What I'm trying to do is simple and should be very straightforward in my mind. The results have been less than encouraging. What I'm trying to do: I have a web page that receives base64-encoded PNG image data. I can and have successfully taken that data through the proper steps t...

A kind of static variable in PHP

Hi, I would want to display a certain message on a php page at a let's say 15 displayed pages. So it displays the message once and after 15 again and so on. I should need a varaible that keeps it's value between pages reload. Can I do that with PHP? thanks. ...

Turn array into independent function arguments - howto?

I want to use values in an array as independent arguments in a function call. Example: // Values "a" and "b" $arr = array("alpha", "beta"); // ... are to be inserted as $a and $b. my_func($a, $b) function my_func($a,$b=NULL) { echo "{$a} - {$b}"; } The number of values in the array are unknown. Possible solutions: I can pass the ar...

Invoking a PHP script from a mysql trigger

Is there anyway invoke a PHP page / function when a record being inserted in to the mysql db table. We dont have control over the record insertion procedure.Is there some thing called trigger which can call a PHP script back ? ...

Get the layout mode (landscape or portrait) of a pdf from php/linux

Given a PDF, how can one get the layout mode of a PDF (or relative width/height) using a PHP lib or linux command line tool? Using http://www.tecnick.com/public/code/cp%5Fdpage.php?aiocp%5Fdp=tcpdf which can set this variable on new PDFs, but for existing pdfs from adobe. Thought of converting pdfs to ps, or using gs in some other way ...

Changing the mime type of a non-php file?

I have a file (*.lwxl) that I would like for users to download a file, but the mime-type is text/html, and I would like to change it to application. Is there any way to do this? ...

How to generate unique id in MySQL?

I'm programming a script using PHP and MySQL and I want to get a unique id (consisting of a string: capitals and small letters with numbers) like: gHYtUUi5b. I found many functions in PHP that can generate such numbers but I'm afraid about how to ensure the id is unique! UPDATE: uuid is long, I mean such id like: (P5Dc) an 11 alphanum...

What is the best way to approach OpenSocial integration via PHP?

I'm looking to implement OpenSocial on my web application, which is written in php/mysql. What is the best way to go about doing this? For instance, are there options along the way? Is one path better than another? What should my scope be for a good first version? I just want to get it working for version 1, is there a logical path to a...

Adding attributes to submitted content links

I have a site where people will submit text. I want to add a couple of attributes to links that are added. Anyone know a regular expression (or another good way) to add rel="nofollow" to any link that is in the body of the text that is submitted? ...

Is it possible to determine a file descriptor's status in PHP?

I have a file descriptor (edit: the resource returned by fopen on a stream that is not necessarily a local file) that is being passed into a black box. When it pops out, is it possible to determine with any certainty whether or not the descriptor has been closed? Edit: It looks like the function get_resource_type($fd) will return "Unkn...

Mysql as a PHP DSO

I have a server that is running live (in process of turning it into a dev server but need some stuff off it first) so we don't want to recompile php to break anything. On the new server we have the dynamic extensions of mysql.so and mysqli.so I haven't been able to find anything about the details of building one myself, so copied them o...

NWS LSR Documented Format or Retrieval (PHP)

I am attempting to find documentation on how Local Storm Reports (LSR) issued by the Nation Weather Services are formatted. Also I am aware of public FTP directory these text files are stored but I was wondering if anyone knows if the NWS or other sources provide these reports via a web service instead if having to manually write a par...

Code displayed in one line after FTP upload/download

Hello, When I upload/download some HTML/CSS/… file to FTP server, sometimes something puts every line of code in one line making it completeply unreadable. That something happens every now and then and I’m still looking for an explanation for this behaviour. What could cause this? ...

PHP mysqli reconnect problem

I am having trouble using the mysqli class in PHP and I haven't been able to find the answer anywhere. In my script a class creates a mysqli connection that it uses throughout it's functions. Afterward, this script forks. The connection is used by the children as well, but I'm running into the problem of the connection being closed (MYS...

Call a class inside another class in PHP

Hey there I'm wondering how this is done as when I try the following code inside a function of a class it produces some php error which I can't catch public $tasks; $this->tasks = new tasks($this); $this->tasks->test(); I don't know why the initiation of the class requires $this as a parameter either :S thanks class admin { func...