php

HTTP_Request::setPostFields is an undefined method

Hey, I've been battling with PHP all morning and it's now really starting to bug me! I've had a hard time getting HTTP_Request to work at all, but now it seems happy with everything but setPostFields() which it claims to be undefined... Here's my code - I'm a new PHP coder, so be gentle on my (non-existant/terrible) coding style. requ...

PHP Exam - Object Oriented Programming - What's the answer?

Can someone tell me if are the answers for this questions are correct Q: Type-hinting and the instanceof keyword can be used to check what types of things about variables? Answers (choose 3) a) If a particular child class extends from it b) If they are an instance of a particular interface c) If they are an abstract class d) If they h...

mysql_fetch_array problem

Hi guys, i am trying to do a guestbook in php but i am having some problems with mysql_fetch_array function. I don't understand why. I try to debug by putting die("Error ".mysql_error()) but nothing prints out. I guarantee that all my variables are correctly initialized. Here is my code : <?php $nbmessagesPP = 10; mysql_connect(HOST...

Facebook API Upload Image

I'm having trouble uploading photos to Facbook within my canvas application. I'm able to upload the image using the REST API if the file is stored within my server, however allowing a user to upload it without first transferring to my server is the difficulty. ...

[PHP] - Split html text without breaking "open" tags

I'm using a PHP function to split text into blocks of max N chars. Once each block is "treated" somehow, it is concatenated back again. The problem is that the text can be HTML... and if the split occurs between open html tags, the "treatment" gets spoiled. Can someone give a hint about breaking text only between closed tags? Requiremen...

Fetch cookie set by header

Hello, I login to a website and it returns a cookie via the header. The cookies name is fb_cookie. I try to read it with the below PHP code but it returns nothing. How can I fetch a cookie set via the header? echo $_COOKIE["fb_cookie"]; The response is this from the header (read by the Poster plugin in Firefox). fb_cookie=1554e662b9...

PHP DOM replace element with a new element

Hello, I have a DOM object with loaded HTML markup. I'm trying to replace all embed tags that look like this: <embed allowfullscreen="true" height="200" src="path/to/video/1.flv" width="320"></embed> With a tag like this: <a href="path/to/video/1.flv" style="display:block;width:320px;height:200px;" id="player"> I'm havin...

How do I show a different from address in my emails? using zend framework

FIrst of all I don't intend to spam - I 'm building email facility in my application and would like to be able to include any email address in the from header of the email while be able to send it from any mail server i.e like show a yahoo address in the email from field while send it from my own smtp server? Is it possible? I'm using ph...

php domdocument: when i create an xml, how can i ident each element properly?

Hiya. When i create an XML using php's DomDocument it creates the xml properly but all the elements are in one line, the xml file itself is not so readable. I searched in google and find that the attribute formatOutput in DomDocument should resolve the issue, i use php 5.3 and i do not have this properly in DomDocument. any ideas? ...

is there a "double" type in PHP

if not, then how to declare a double type of number? function testFloat(float $f) { return $f; } echo testFloat(1.2); Catchable fatal error: Argument 1 passed to testFloat() must be an instance of float, double given ...

Can Exist query MySQL?

Greetings Gurus... Is there a way to interface with a remote mysql db from within an Exist database stored xquery? I am working on a stack that uses php as the main programming language, and xqueries are either stored on exist or they are passed along to the exist server using the php javabridge. Currently, what I have to do is constru...

using global inside of function to get variable from included file. PHP

Hi, Really simple I just think it's me. this is file 1.php if(ctype_digit($_GET['id'])) { $item_id = "Hello"; } else { //Something } this is file 2.php function item_show(){ $item_query = "SELECT title FROM tbl_items WHERE id='" . mysql_real_escape_string($item_id) . "' "; } Now my question is how do I get the...

use regular expression in php

..(content)............. <A HREF="http://test.com/content" >test link </A> ...(continue content)... I want to delete link with content. And also text between link. ...

How do I transform "ТеÑ" (it is russian word) into something readable?

Hello, I got MySQL DB which contains UTF8 column with such "ТеÑ" records. PHP's mb_detect_encoding() told me that this is UTF-8. How can I transform this "horror" into something readable? Thank you ...

How to compare 2 Websites after changes in Backend / Framework

Following "problem": Website build with PHP/HTML working We want to change this site to PHP + Zend Framework + HTML The Goal: After implementing the Framework the site should look like without the Framework. Is there any way to test this automaticly? If we just save the page before and compare it with the new version i will not work ...

PDO Query not printing anything

I have the following function which enables a query to run with a where condition. But it seems not to be producing any results. I can connect to the database so that is not an issue. Any help would be appreciated. public function executewhereQuery(Array $tableData, $fieldType, $table, $tableField){ $dbh = $this->connect(); ...

What's the best way to write to linux system files using PHP

We need some scripts to generate config files for network services such as DHCP, DNS and Network based on user input. These require root access, but I don't know how to run the PHP application as root. It's run through a public web interface. ...

Validate class/method names with regex

Heya guys. I'm currently working on an MVC Style framework for a company and for security reasons I need to make sure that the controller / method that's passed via the Query String is valid chars to the RFC (which I can't find). I need to be able to validate / sanitize class names according to what's allowed by the PHP interpreter Fo...

How can call a PHP function from Perl code?

I have a function written in PHP and would like to call this inside a CGI script. Is there any direct way to do this? I am not sure if its even possible. The CGI script will be inside cgi-bin directory and the PHP function will be outside this folder. ...

How do I filter this URL??

I am not able to find a code to filter this in PHP.. I do have multiple urls for example : www.google.com www.twiter.com www.facebook.com www.youtube.com www.techcrunch.com/webroot-brightcloud/ www.mashable.com/hello-how-are-you/ www.yahoo.com www.msn.com what I want is I need to filter domains with sub directories or pages. here in ...