php

How to get SSL certificate info with CURL in PHP?

Hi, I would like to be able to read the SSL certificate information with CURL. From the Linux console I get this response header: GET https://www.google.com/ -ed Cache-Control: private, max-age=0 Connection: close Date: Sun, 20 Jun 2010 21:34:12 GMT Server: gws Content-Type: text/html; charset=ISO-8859-1 Expires: -1 Client-Date: Sun, 2...

constants and mysql, best practices

Hello, I currently have a list of defined constants and a function that regex'es every pulled MySQL string and looks for things like CLIENT_NAME, LOCAL_API_ADDRESS and auto-changes it. // several fields define ('CLIENT_NAME', '...'); define ('LOCAL_API_ADDRESS', '...'); ... The thing is, as my app is getting larger I feel this is pre...

MySQLi as an static class

I have the following code that is able to create a class that has a single static instance of the database object, and two static functions for rows and columns. <?php class Database{ private static $instance; private function __construct() {} private function __clone(){} public static function call(){ if(!iss...

Problem while executing Facebook query

Hi , I am trying to run a FQL for the first time. This is the code I have included in my index.php file: <?php $query="SELECT message FROM status WHERE uid = 544337058";echo $query; ?> <?php include_once ('facebook.php'); $api_key = 'XXXXXXXXXXXXXXX'; $secret = 'XXXXXXXXXXXXXXXXX'; global $facebook; ...

Returning HTML (with PHP) after jQuery Ajax function.

I'm trying to use Ajax together with jQuery to make a little window pop up when you click on a username in my custom forums. My current code for the script: $(document).ready(function(){ $('#profile_link').click(function(){ $.ajax({ type : 'POST', url : 'viewuser.php', dataType : 'html', contentType : 'text/html...

Keeping realtime views of cached content

Hi, I'm working on a busy web site. Sometimes it gets much more traffic then avarage days. The content is cached but as site's owner want to see realtime post views it has to do at least one query to MySQL per post view which is become performance problem under heavy load. All I can think of is create a different table for views and upd...

delete parent of node

I have xml, structured like this <element> <x> <y> <z>Value</z> </y> </x> </element> I select all <z>-tags from xml by this xpath query - //*[name()='z']. Then i work with every finding node, and if it not satisfied some demands a need to delete whole X-tag (grandparent of , if you like :)). forea...

How to return all database rows with certain field value.

Hey, I have a database table called "projects" with the fields 'id', 'locationid', 'name' and 'year'. I query the database to retrieve all the values and store them in $data, before passing them into the relevant view. In what part of the website, I have created a timeline (made of list items generated with a foreach). In this timelin...

How can I check if 'http://' is in the variable, and if not, add it?

Basically, I'm using gethostbyname() to get the IP address of the specified URL, using parse_url() to determine the specific domain. However, this doesn't work if http:// is not in the URL (unless I'm missing an option) So how can I check if http:// is in the URL, and if not, add it appropriately? Or if have a better alternative, I'd l...

Sitemap Encoding Woes

Hi, I'm having real trouble understanding the specification and guidelines on how to properly escape and encode a URL for submission in a sitemap. In the sitemap.org (entity escaping) examples, they have an example URL: http://www.example.com/ümlat.php&amp;q=name Which when UTF-8 encoded ends up as (according to them): http://www.e...

How to fetch file contents via AJAX without visible refresh spinner on iphone

I am developing a web app for iphone which requires the application to check for changes in a text file, and as soon as a change is detected, to complete certain actions. The text file changes around once every 3 but the change has to be detected almost instantly and so I'm currently doing an ajax refresh every second. This works perfe...

mkdir Function Error

Hi everyone, I am stuck on a simple script. I have tried Googling it and I have tried all of the stuff I found on Google but none of it has worked for me. I am trying to you the mkdir function but I keep getting an error that says: Warning: mkdir() [function.mkdir]: No such file or directory in /home/content/l/i/n/web/html/php/mkdir.php ...

Headers already sent error in CakePHP app

function new_photo() { if( !empty($this->data)) { $this->data['Photo']['showcase_id'] = $this->Session->read('CurrShowcase.id'); $this->data['Photo']['added'] = date("Y-m-d H:i:s"); $this->Showcase->Photo->save...

Generating a unique id for a given string using php

I'm using Zend_Cache_Core with Zend_Cache_Backend_File to cache results of queries executed for a model class that accesses the database. Basically the queries themselves should form the id by which to cache the obtained results, only problem is, they are too long. Zend_Cache_Backend_File doesn't throw an exception, PHP doesn't complai...

Callbacks as part of a static member array.

Recently in a project I am working on, I needed to store callbacks in a static member array, like so: class Example { private static $_callbacks = array( 'foo'=>array('Example','do_foo'), 'bar'=>array('Example','do_bar') ); private static function do_foo() { } private static function do_bar() { } } To c...

"current" class on menu

Heya, I'm creating a menu and was wondering if how i would add a class of "current" on a menu for the current page e.g. http://emberapp.com/. Any help appreciated! ...

How to pass a parameter to an applet? (secure mode)

Hello, I've been trying to find a proper way to pass some information, such as password, to my applet. Since the code is executed on the client, I don't want to put that information in clear text in the "param". I'm using php as script to generate the web page. So, I was wondering if there was already some kind of solution/mechanism? ...

HTML PHP JavaScript Whatever to Check Gmail Unread Count

How do all these browser plugins, notifiers, etc. check your gmail unread count? I'm trying to write a Safari Extension (which happens to be in javascript but I don't think it matters) and I can't figure out how to parse the Gmail atom feed (https://mail.google.com/mail/feed/atom) to get the unread count. Thanks, ...

how to show hit counter then make it back to zero?

hi all.. i want after i've been submit form it can show hit counter.. but i want after it reach "20" it can back to zero..bcoz the limit of submit is 20 times so it can't over the limit. how do i make it works?I've been try to this code... <? $limit="20"; $Query_counter=mysql_query("SELECT model FROM inspec"); $Show_counter=mysql_fetch...

PHP's _get & _set or unique get and set functions for each variable?

PHP has _get and _set functions built in. Is it better to write my own get and set functions for each variable or use the built in functions with a ton of if else if? What are the pros and cons of each method? ...