php

PHP class function not working

Hello Folks. I'm new to PHP and web scripting in general so this a newb question. Currently i'm a creating an instance to an object, yet when I call the constructor the script slienty shuts down... it doesn't call the next function and I don't know why. Any help would be welcome. Here is the code. <?php class product { var $ssPro...

How to gracefully handle a downed API

With twitter being down today I was thinking about how to best handle calls to an API when it is down. If I am using CURL to call their api how do I cause the script to fail quickly and handle the errors so as not to slow down the application? ...

Can I get the short DOS name of a file from PHP?

I want to pass a file path as a parameter to an executable from PHP, and the file path may contain spaces. The executable doesn't seem to handle quotes around the parameter, so I thought maybe I could pass the short DOS name instead of the long name. Does PHP know anything about the old-style DOS 8.3 file names? ...

Can I parse PHP locally without the use of a local host server?

Often, when I am developing in PHP, I want to see minor changes instantaneously. This requires me to either FTP to a web server and then refresh, or use a localhost server, both of which(as I understand) are essentially the same thing. What I would like to know is, is there an IDE or other way to parse PHP output in a dynamic fashion? ...

iterating over unknown XML structure with PHP (DOM)

Hi all I want to write a function that parses a (theoretically) unknown XML data structure into an equivalent PHP array. Here is my sample XML: <?xml version="1.0" encoding="UTF-8"?> <content> <title>Sample Text</title> <introduction> <paragraph>This is some rudimentary text</paragraph> </introduction> <description> <paragra...

Read pdf files with php

I have a large PDF file that is a floor map for a building. It has layers for all the office furniture including text boxes of seat location. My goal is to read this file with PHP, search the document for text layers, get their contents and coordinates in the file. This way I can map out seat locations -> x/y coordinates. Is there any ...

PHP - Code Almost Does What I Want it to

Hello, The code below echoes the following: Table Name 1 Table Name 2 Table Name 3 Table Name 4 "$entry": "votes_up for $entry in Table Name 4" I want it to echo this: Table Name 1: "votes_up for $entry in Table Name 1" Table Name 2: "votes_up for $entry in Table Name 2" Table Name 3: "votes_up...

Is there a generic way to route URLs in Kohana when there is the hyphen character in them?

Kohana automatically sets up URLs like so http://www.example.com/controller/method/argument1/argument2/etc Now I like to use the dash to separate my words in the URL, and I have an address like so http://www.example.com/business-hub My controller is titled BusinessHub_Controller. What is annoying me, is for /business-hub/ to match th...

Question about strpos in PHP

I'm just trying to figure that out... $mystring = "/abc/def/hij"; $find = "/abc"; echo(strpos($mystring, $find) . "<br>"); if (strpos($mystring, $find) >= 0) { echo("found"); } else { echo("not found"); } this will give : 0 found $mystring = "/abc/def/hij"; $find = "/fffff"; echo(strpos($mystring, $find) . "<br>"); if (str...

in php is there a way to dump "all" variable names with their corresponding value?

if the title seems too vague.. uhm i wanted to display every variable that i used to generate a page along with their variable names and values, is it possible and how? foreach($_SESSION as $varname => $value) { print "<b>".$varname."</b> = $value <br/>"; } ^the above sample is what i use to display all session variabl...

PHP / Drupal, Session Storage and encryption

We're using Drupal on a number of sites. On all but one server, the data in the sessions table appears as a serialised string. This is normal behaviour AFAIK. On the exception server, the session data is stored looking like, _C0c5x_xpVKkya5nD68ChpaKaHYNzWTlEN52gOCkH1fIAvj3ziCydGnNbLXTO75q_pYLhumOYHzxD1D _ue5tRgeeQR4YUIDWtAZ2hxlJ7QUHS-K...

How to change the position of module of magento cart???

How i change the position of module of magento cart??? ...

How to deal with session timeouts in AJAX requests

I'm sure you're all familiar with the voting systems that use AJAX (Um... look right over there <----) I have something similar and when you vote up or down it uses AJAX to request the new value from votes.php. The problem is that I am using a session to get the userid so a person can only vote once. What happens if they sit on the page...

anti pornography image uploading

Possible Duplicate: What is the best way to programatically detect porn images? Im currently working on a site were i would like to offer the users to freedom to upload images to be displayed on said site. The problem is i dont want pornographic images to be displayed. i know google and other sites are already using some sort of...

Magento - Show Custom Attributes in Grouped Product table.

I need to find a way to show the value of a custom attribute in place of the "Product Name" shown in the image below. I'm working with /app/design/frontend/default/defaultx/template/catalog/product/view/type/grouped.php The code below doesn't work(the custom attribute is yearmade): <?php if (count($_associatedProducts)): ?> <?p...

Whats the best way to transport a file to a different server?

Im running a file host thats grown beyond the capacity of a single server, and I need to implement multiple server storage of files. I'd like to do this as cheap as possible, so those fancy mass storage methods are out of the question. I simply want to move a file thats uploaded by the user to the "gateway" server, which hosts all the ht...

Warning: mysql_connect(): Can't connect to local MySQL server

Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (11) in /home/aa/public_html/bb/db.php on line 2 Could not connect: iam getting this error but the problem is that this error comes irregularly,sometimes it didnt come all the day and sometimes it comes countless times. what could b...

Coding collaboratively for the web

In the past I've done the coding-part of my web-projects mostly by myself. Now, as we are a team working on some project, be it phython or php or ..., is there some simple versioning system to use? My hoster doesn't seem to support any kind of this sort. On the other hand, I feel it is too early to start renting a whole server in this p...

Need a simple Regular Expressions here

Hi guys, I'm finally parsing through wikipedias wiki text. I have the following type of text here: {{Airport-list|the Solomon Islands}} * '''AGAF''' (AFT) &ndash; [[Afutara Airport]] &ndash; [[Afutara]] * '''AGAR''' (RNA) &ndash; [[Ulawa Airport]] &ndash; [[Arona]], [[Ulawa Island]] * '''AGAT''' (ATD) &ndash; [[Uru Harbour]] &ndash; [[...

How to swap product image that is already in cart depending on selected product option?

Hi everyone, recently I was needed to enhance Magento (1.3.1) user interface. Particularly add a product image switcher (following http://inchoo.net/ecommerce/magento/create-a-color-switcher-in-magento/). The results: - image switcher works as expected, which is fine. The problem: - The product itself could hold as much as 15 or 20 col...