php

How do I get an edit token for Mediawiki?

Hello, I want to get an edit token via a HTTP POST command. The API documentation says only Edit token. You can get one of these through prop=info Using action=query&prop=info&titles=Main Page&intoken=edit does not give me a token. How to get it? ...

PHP try-catch blocks: are they able to catch invalid arg types?

Background: Suppose I have the following obviously-incorrect PHP: try{ $vtest = ''; print(array_pop($vtest)); }catch(Exception $exx){} For it to work with array_pop, $vtest should obviously be an array, not a string. Nevertheless, when I run this code the Warning is exhibited. I don't want that, I just want the...

Transforming Results of PostgreSQL Query to XML, using PHP DOM

Hey everyone, Given SQL as an input, I have to query a PostgreSQL database and return the results as XML. I have done this with the following code: <?php $link = "host=localhost dbname=company user=pgsql password=password"; $connect = pg_connect($link); $query = "SELECT * FROM customer"; $result = pg_query($connect, $query); $doc =...

retrieve last updated column in mysql

Hi, I have a MySQL query that goes as follows (using Zend_Db): $sql = $handle->quoteInto("UPDATE board SET rank=rank+1 WHERE post_id=?", $postid); $handle->query($sql); (Rank isn't an auto-incrementing PK). I would like to now retrieve the value of rank without preforming another query. I've tried $handle->lastInsertId(); but it doe...

PHP RegEx Grouping Multiple Matches

I'm just trying my hand at crafting my very first regex. I want to be able to match a pseudo HTML element and extract useful information such as tag name, attributes etc.: $string = '<testtag alpha="value" beta="xyz" gamma="abc" >'; if (preg_match('/<(\w+?)(\s\w+?\s*=\s*".*?")+\s*>/', $string, $matches)) { print_r($matches); } ...

Magento My Account Layout XML Problem

Hi there, I'm having issues getting the customer.xml layout file to work properly for the customer's "my account" pages. The navigation links and the previously ordered items that are usually on the left hand side of the page won't show up on the page, but if I change the reference name to "content" in the xml file, it shows up (except...

How can i get the list of available arguments for a php function

Hi, is there a way to get the available arguments for a php function? Example: I want to call function1($arg1, $arg2=null) How can i find out a priori, before i call the function, the number of arguments this function takes, and if it's possible what arguments. As you can clearly see i am dynamically calling functions ...

Removing decorators on Zend form elements by parameters

Zend automatically adds tags around form elements it has generated. How may I remove these tags as paramaters to the addElement function. I have tried changing the disableLoadDefaultDecorators flag, however the element does not render at all then. For example: $searchForm->addElement('text', 'searchText', array('class'=>'onClickClear'...

Formatting php $_POST for document printing

Im trying to make a html form processed in php that outputs to pdf and is print ready. This is what I have: A page requesting the categories to include A page which presents text areas for that categories A page which displays the final result with an option to print and or make a pdf. I can make all the information pass along the p...

How to check if PDO support is enabled in my Apache Installation?

I am using a shared hosting through CIPL.in. They use cpanel. I am trying to deploy a ZEND app on my website. However it keeps giving the error. An error occurred Application error Exception information: Message: The PDO extension is required for this adapter but the extension is not loaded Stack trace: #0 /home/cubeeeco/worminc/libr...

Want to remove my inline JS Event Handle but no idea how

Howdy, i think iam going crazy .. I have an webpage where iam displaying news comments dynamicly , the "Comment" link is connected to an JQuery function wich is displaying the comments for the news (..like show comments from news id = x) But "onClick" handlers arent the best way or? Thats my code in the moment : ech...

Good practices for sending mails from PHP via smtp?

I will have to send mails from a php website via smtp. The smtp server is at a different hoster. Mails will only be sent and not received. Sending multipart emails (atachments, simple HTML) should be supported. The site will send for reasons like registration confirmation, ticket creation, contact form, newsletter registration, mass ma...

How to use jCarousel with PHP function?

I'm still learning both PHP and jQuery, and this seems to me to be a reasonably complex thing to try and do. What I'd like to be able to do is use jCarousel's textscroller capability to display a list of URLs generated by a PHP function rather than the XML feed and URLs that jCarousel is written for. (Demo: http://sorgalla.com/projects/...

Collecting/Processing headers in PHP Soap Server

I'm creating a web service using PHP5's native SOAP Methods. Everything went fine until I tried to handle authentication using SOAP Headers. I could easily find how to add the username/password to the SOAP headers, client-side: $myclient = new SoapClient($wsdl, $options); $login = new SOAPHeader($wsdl, 'email', 'mylogin'); $password =...

Is folder uploading possible in PHP?

Is there any way to upload an entire folder using PHP? ...

jQuery.get() method doesn't want to work

I am trying to load WalkScore Map into one of div's on the page. For some reason my code works only if I alert() something right after $.get() method. Have no idea why. Can someone suggest something? Thanks. <html> jQuery - Ajax dynamic content loading function loadWalkScore() { $.get("http://www.walkscore.com/ti...

Implementation Advice: How to upload to different server without reloading page

Hello all, I really need advice on how to do the following. I have tried several things and they have not worked. I would like to upload a video to viddler using their REST API. I wish to upload a video directly to them. However, I want to upload to them without reloading the page? How can I do this? I have tried AJAX with an iFram...

How can I show different content to website visitors from a specific country in PHP?

On my Wordpress blog, I want to show additional content to people from Finland on all pages. Very much like the Feedback button at the left edge of the screen on printfriendly.com. How can I achieve this most reliably using PHP? ...

PHP - removing a backslash from an apostrophe

Hello, The code below allows the user to enter in a phrase in plain English, which is then added to a database as "$site." If the user enters in an apostrophe, the phrase is stored with a backslash in front of the apostrophe. How can I get the variable "$site" to be added to the database without backslashes in front of apostrophes? ...

Safe Dynamic Include

I been using this php dynamic include code on my site. But I think it not safe, how can write safer and better code to replace this: $page = (empty($_GET['page'])) ? '' : $_GET['page'].".html"; if (empty($page)) { $page = 'index.html'; } else { $page = $page; } include($page); Thank you very much ...