php

php socket http post not working

I'm trying to write a php script to send a http post request to a url. It doesnt seem to pass through for the server is not receiving it. Can anyone help? <?php function postXMLToURL ($server, $path, $xmlDocument) { $xmlSource = $xmlDocument; $contentLength = strlen($xmlSource); //$fp = fsockopen($server, 80); $fp = ...

PHP 5.3.2 and Zend Framework Sessions

We recently upgraded our PHP and apache versions on our server. Prior to this our sessions were able to be carried over between subdomains without error. Unfortunately when we made the upgrades it stopped working. From what I can see everything is the same. I have tried ini_set("suhosin.session.cryptdocroot", "Off"); ini_set("suhosi...

Ghosting PHP functions like in Javascript

Original Question Since a recent version of php added anonymous functions, is there a way to extend functions? in Javascript I'd do: var temp = immaFunction; immaFunction = function(){ //do some random stuff temp.apply(this, arguments); } Result As of 5.3, PHP has first class anonymous functions. A few points to consider however...

PHP foreach loop

I have the array example below that I am using to dynamically create an SQL query based on the options ticked in a form. The code below tests whether there is a value, if so, append it to the array: if ($lookchild) { $val[]='lookchild'; } if ($mentalcap) { $val[]='mentalcap'; } if ($mentalheal) { $val[]='mentalheal'; } if ($olderpeople...

Resource garbage collected too early

I've created a PHP extension with SWIG and everything works fine, but I'm observing some strange garbage collection behavior when chaining method calls. For example, this works: $results = $response->results(); $row = $results->get(0)->iterator()->next(); printf('%s %s' . "\n", $row->getString(0), $row->getString(1)); But this seg fau...

Trying to AVOID an ASP.NET session using cURL

I'm using a web-service from a provider who is being a little too helpful in anticipating my needs. They have given me a HTML snippet to paste on my website, for users to click on to trigger their services. I'd prefer to script this process, so I've got a php script which posts a cURL request to the same url, as appropriate. However, thi...

How to sort by Date from MYSQL using PHP

I have a php page which allows a user to sort pieces of information by several factors. A new requirement is to sort by "all items which have been registered in the last 15 days". I store my dates in the MYSQL table as mm/dd/yyyy. The information is passed and picked up on the same page using the $_GET variable but I am unable for some...

Perfectly good PHP/MySQL Login script not working

Hey guys, I've been bashing my head around for hours now, over this login script. It's the one I always used, and I know it works on my version of MySQL. It just won't send me through to the correct authorized page, it will always redirect to the "login_failed.php" file. Any help is much appreciated. <?php ob_start(); $host="localhost"...

Drupal allow FULL html as input format

I have a specific kind of node in which the user must paste FULL html into the body field. E.g. html including the html, head and body tags. Apparently, Drupal's version of "full html" is infact not "full html" as it strips out these tags. How can I circumvent Drupal? ...

PHP create cookie and only show website if cookie exists

I want to protect a website from being accessed until a user has agreed to something. The basic idea is that at the top of each page it will check if the cookie exists if not then exit and include a php page that contains the message and two buttons one which will create the cookie and the other simply moving them off the site e.g. googl...

Why is my picture being rotated with this script?

Not sure what the heck is going on?? But if I have a lager picture uploaded (portrait) style, then it crops it and then rotates it?? What am I missing. It would be nice just to have a max_width and let the ratio do the rest?? Thanks in advance. <?php function uploadImage($fileName, $maxSize, $maxW, $fullPath, $relPath, $colorR, $...

Validate media objects in PHP

I want to allow users on my website to link to remote media objects: flash, music, movies, etc. I already have a regex to check for links: /(http|ftp|https):\/\/[\w-]+(.[\w-]+)+([\w-.,@?^=%&:\/~+#]*[\w-\@?^=%&\/~+#])?/i With the matched links, I want to check if they are media files instead of just checking for the the extension on the...

Header issue, wordpress

Tried to make a change to the address in the header.php, and for some reason it changed only in the index file and not in any of the other pages. Can anyone tell me why this is? In the index page and both other page template options the header is called the same... <?php ?><!DOCTYPE html> <html <?php language_attributes(); ?>> <head> ...

Creating a magento component from scratch

I am trying to create a magento shopping cart module but things arent working out. Here is my steps I first create a xml in the app etc... <?xml version="1.0"?> <config> <modules> <mywebwow_AdvancedCatalog> <active>true</active> <codePool>local</codePool> </mywebwow_AdvancedCatalog> </mod...

Does this array function exist in PHP?

Is there a PHP function that will do the following: Move a specified array value from it's current index and then either: Moved in between two existing indices. Swapped with a second index/value. I made the class below for the task, but wonder if there is a pre-existing function in the PHP library? Here is the class I have created ...

Add attributeSet but based on a an existing set - Magento

Ok, its possible to add a new attribute set in magento using something like the following: $entitySetup = new Mage_Eav_Model_Entity_Setup; $entitySetup->addAttributeSet('catalog_product', $setName); But how can i base the set on an existing set like the default. This option is available in the admin section so its possible. ...

PHP returning content-length of 0 to python's urllib

My code fetches CSV data from a PHP page using httplib. When I open the page in Firefox or Chrome, the data displays just fine. However, when I try to fetch it with my python code, I get a header with content-length: 0 and no data. This page is the only one that does this - in another page in the same directory, the python httplib fetchi...

what does this PHP operator =& means?

Possible Duplicate: what do =& / &= operators in php mean? I found this operator "=&" in the following code, and I do not know what it means. Could someone explain what it means and does? THE CODE WHERE I READ IT: function ContentParseRoute($segments) { $vars = array(); //Get the active menu item $menu =& JSite...

PHP Cronjob with CPanel

Hello! I've never set a Cronjob before. Is it enough to just write the php file I want to execute (in this case send a mail every 24h) and follow through the CPanel GUI prompts? Thanks! ...

Is Application Object created and destroyed on every Request ?

In PHP there are many Frameworks and all of them have the Concept of Front Controller or Entry Script or Application. Basically all of them mean that on a Http Request by a Browser , an Application Instance is created ( Like in Zend Framework , Instance of Zend_Application and Yii::createWebApplication in Yii) and each Application Instan...