php

Mechanize and BeautifulSoup for PHP?

I was wondering if there was anything similar like Mechanize or BeautifulSoup for PHP? ...

If I have two instance of a class and I use $this to reference one of the instance without specifying which, what will $this take?

PHP scripts register.php: $compareUser = new User(); $user = new User; verify.php (executes with a link from register.php, passes two variables to User.php) User.php setActive($token, $uid){ $this->username = /???? } *assuming that User has a username property, which instance of the User class will $this take? $compareUser o...

How can I resolve the "Resource ID #8" error message in PostgreSQL/PHP?

How can you solve the Resource ID #8 -error message in the following code? The error apparently means that I have a bug in my SQL statement. However, I cannot see it. $result = pg_prepare($dbconn, "query1", "SELECT user_id FROM users WHERE email = $1;"); $result = pg_execute($dbconn, "query1", array("[email protected]")); // to r...

Why is mime_content_type() deprecated in PHP?

I'm just curious to know why mime_content_type() is now considered deprecated. This method for determining the mime type is much easier than the replacement Fileinfo functionality. ...

Test For Password Protected Folder

How do I use PHP to check whether a folder is password protected or not? I am using a PHP script that check for return codes 401 and 403 but when it runs into a folder that is password protected it recognizes that its a 403 but does not allow the popup box for username and password to display? How do I detect that the folder is password ...

Regex '''string''' to <b>string</b>

I need a regex to replace '''string''' with <b>string</b> this one wont work: '/'''(.*?)'''/' ...

Flexible eCommerce and social networking solution

Hey there! Im currently developing website that will contain e-commerce part and social networking part. Social networking part might have following options: Users Edit profile Upload photos / videos Manage friends Select favorite product (+review) Groups Forums Videos Photos So, basically it is a merge of regular ecommerce store...

Need help with reCAPTCHA - keep getting incorrect-captcha-sol

Hi I am trying to add a reCAPTCHA to my site, but keep getting incorrect-captcha-sol error when I submit the answer. Can anyone tell me if I am correct in doing the following? I have a generic index.php, which includes contact.php. In contact.php I have inserted the following code: require_once('recaptchalib.php'); $publickey = "XXXX...

Is it possible to apply multiple string interpolation in labels for form_validation custom callback methods in CodeIgniter?

I'm not sure how I should phrase this, so pardon me for my lack of narrative.. Here's an approximate form of my current code, trimmed down to the essentials of the problem (PHP v5.2 / CodeIgniter v1.7): In system/application/config/form_validation.php, I have a rule that looks like this: 'some_controller/save' => array( array( ...

Problem while i am trying to display the events in the calendar ?

Hell all, I am creating a event module. In that as usual after creating the event we need to display the event title in the popup when clicking the date in the calendar. its working. but if i have multiple events in the same day its just showing the first event. Template Engine i used here is SMARTY. And i used {literal} to differentia...

parsing xml and insert data in mysql table

I am parsing an xml file using php simplexml_load_file() and then inserting the desired data in a mysql ISAM table. The problem is that the code works "most" of the times, with 500 internal server errors here and there. The XML file that I am trying to process is big (around 50 MB), and it yields around 25000 rows in the mysql table when...

Zend_Controller_Router_Exception: "xyz" is not specified

Hi! I have a problem in my current Zend Framework application. In my Bootstrap I register these routes: protected function _initRouter() { $this->bootstrap("FrontController"); $frontController = $this->getResource("FrontController"); $route = new Zend_Controller_Router_Route( ":module/:id", array( "controll...

Regex to match content of HTML body in PHP

I need a regex in php for matching contents between tags of an element, e.g. <body> and </body> with the perl compatible preg_match. So far I tried with: // $content is a string with html content preg_match("/<body(.|\r\n)*\/body>/", $content, $matches); print_r($matches); …but the printout is an empty array. ...

heredoc with eval code execution

I've tryed a couple of methods to try and get this working but with no luck! I've got a page like this (Example): <?php $jj = <<<END ?> <h1>blah blah</h1> <p> blah blah blah blah blah blah blah <?php include("file.php"); ?> blah blah</p> <?php END; eval('?>'.$jj.'<?php '); ?> this causes no output what so ever, can not think of a sol...

best way to filter unwanted elements from html before rendering

I have a variable $example that has html content that I need to render/echo to screen. But before rendering to screen, I want to remove certain elements. For instance the structure of the $example variable is: <form> some stuff here... </form><p>hi there</p><div></div> I want to remove the form element from the $example variable befor...

Efficient way to realize permalinks in php

What is the most efficient way to realize php-driven permalinks? Basically I want to reduce the database accesses to a minimum. What is the best way to redirect to an id stored in the database? ...

Stack Overflow on IIS 6.0

Hi, I am using WAMP as localhost on my pc, and upload all data to the hosting (using IIS 6.0). I am using lightbox gallery in one post, and in the sidebar, to show recent photos from that gallery (on the sidebar). my code on the sidebar as follows: echo do_shortcode('[gallery id="66" size="large" columns="4" num="12" pagenavi="0"]'); ...

jQuery how to swap each instance of "&" append <span> tag to each element

Like the title says, I want to be able to, on page load, search through the text located inside #wrapper. If there is a "&" I want it to have a span tag applied to it and a class appended to that span. Ie: if it finds "hello & Welcome" it should end up like "hello <span class="amp">&</span> Welcome". I did have some code Ive been t...

Fixing PHP_Beautifier's empty lines' problem

I am currently using PHP_Beautifier for formatting code with the following command like options -t -l "ArrayNested() IndentStyles(style=bsd) NewLines(before=T_CLASS:function:T_COMMENT,after=T_COMMENT)" It works great except for the fact that it strips out all the blank lines. After a bit of searching, I found it posted as a bug that i...

PHP MYSQL Hyperlinks and Form Fields

I want to use a hyperlink to load details into an updatable form page. I have 2 php pages. One returning the id of the last 10 records of a MYSQL query and another returning all field values for a specific record into a form, giving the end user the opportunity to update the field values. Can anyone help me link the two so that when I c...