php

Twitter API: merge retweeted_by_me into user_timeline

Hi guys, I can access both methods using the twitteroauth php library. Just thinking of how to merge the two feeds together in a smart way. Any ideas? ...

Why does responseText have the hostname and timestamp appended to it?

I am trying out a basic AJAX/php test. I have a form with two input text fields where I type in two values and an output text field where, when I push a button, the input fields are concatenated together and output to the third text field. I am doing this via AJAX/PHP. I get the concatenated value output to the third field, but there ...

How I can disable font smoothing on imagick?

I use php+imagick and can not turn off font smoothing. When I used the GD, could simply set a negative font color and smoothing switching off. ...

Character Encoding Mismatch

My scripts are definitely saved in UTF-8. I'm instantiating PDO with "{$this->engine}:host={$this->host};dbname={$this->name};charset=UTF-8". My tables use InnoDB and are collated using utf8_general_ci. My pages are sent either with the Content-Type: text/html; charset=UTF-8 header or the <meta> equivalent. When using PDO to store a € c...

$_POST values from a the second dimension of an array

Using PHP. I'm trying to retrieve $_POST values from a the second dimension of a two dimensional $_POST array without actually knowing the names of the values being posted. Here is what I have; it doesn't work. foreach($_POST as $k=>$v) { $$k=$v; if (is_array($k) == true) { foreach($k as $value) { echo $v...

WordPress Theme Hack - How Do I Call Specific Child Pages Only

I'm going to try my best to explain this correctly :) This question is regarding a Wordpress Theme Hack and php. Currently we are using Coda Blue as a theme see here. Right now the jQuery slider is being controlled by li's that are the tabs of the slider (web design, social media, etc). The tabs are created by making a page, and the ...

php curl , link label extraction

Hi, my collage project is struck for the last two days I have the code to extract the links, but i need the link label also. I need links to be stored in an array and link label to be stored in another array. for example if the site bbc.com has the code sports, i need $linklabel[0]=sports and $link[0]=bbc.com/sports.html. The code is ...

Regular expression help in PHP

I need help again with some regular expressions I'm trying to do (still under heavy learning). Again I'm trying to learn by parsing user agents. Trying to do Firefox now... Take in consideration these UAs: Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.9.0.15) Gecko/2009101601 Firefox 2.1 (.NET CLR 3.5.30729) Mozilla/5.0 (X11; U; ...

PHP, MySQL & JQuery Image display problem?

My script is supposed to display the first 10 images in the MySQL database and have the script hide the rest of the users images until the user clicks the link <a href="#">View All</a> and have the rest of the images slide down when the user clicks the link. My Question: So my question is that my images won't display when the user click...

wordpress plugin help

I am trying to create a wordpress plugin admin menu. The problem I am running into is with the menus. I am trying to add a page in the admin without actually adding the menu link. So for example I want to have a menu called test then I want to have some extra pages but I dont want physical links to them because they are only going to be ...

Challenge - escape this text, safely yet accurately

This is a follow up to my last question here. The answer posted there actually does not work. So here is the challenge. You are given this code (assume jQuery included): <input type=text> <script> $("input").val(**YOUR PHP / JS CODE HERE**); </script> Using jQuery - and not by injecting PHP output directly into the input tag - fai...

How can I add GET variables to end of the current url in php?

I am trying to add a few different GET variables to the url. I could easily do a header redirect to the current page url and then just add the $_GET['test'] in the url. My problem is that I have some GET variables that are in the url already. What I want to do is: Check if there are any GET variables in the url If there is not, the...

Is there a regular expression optimizer in PHP?

Perl has Regexp::Optimizer, is there anything similar in PHP? My searches haven't turned up anything. For example, Regexp::Optimizer would turn /foobar|fooxar|foozap/ into /foo(?:[bx]ar|zap)/ Update: I wanted to keep that question really short so that people would not try to over-interpret it but it turns out it had the opposite...

What is the best way to check whether javascript is enabled in client browser?

I am developing an application that uses javascript to perform some arithmetical calculations in forms. I would like to check if javascript is enabled in user's browser. If it is disabled redirect the user to warning page asking to enable javascript. I am aware of <noscript> tag. It is not enough just to display the message for me. I do ...

PHP error logging not comprehensive?

Hi, I'm working with PHP and have got the error logging turned on and turned up with: error_reporting = E_ALL | E_STRICT log_errors = On error_log = /path/to/file display_errors = Off Now this log files catches most PHP errors but occasionally I will make a change and have the page fail to display with no logging to the file. A s...

Server-side Twitter client possible with OAUTH?

Twitter'll phase out HTTP basic authentication by August 2010. In the link my scenarios are from Desktop Applications. Basically my client should tweet new posts on a website. This would be incredibly simple with HTTP basic auth, because I can store and use my account's username and password in the app to authenticate. However, with OAU...

PHP JSON. Confusing issue

Ok I am running CentOS, with PHP 5.2. I recently added the JSON extension. When running php -i .. after installing JSON, it says json json support => enabled json version => 1.2.1 But when I run phpinfo it's not showing the JSON extension as being enabled. I have added the extension to the php.ini file so it loads the json.so file...

Least sloppy way to enforce allowable values or ranges for class properties

Say hypothetically I have a class... class Main { $prop1 = 2; $prop2 = 23; ... $prop42 = "what"; function __construct($arg_array) { foreach ($arg_array as $key => $val) { $this->$key = $val; } } } Say I create and object... $attributes = array("prop1"=>1, "prop2"=>3...

Error on line 14, php curl dom

<?php $url='http://edition.cnn.com/?fbid=4OofUbASN5k'; $var = fread_url($url);// function calling to get the page from curl $search = array('@<script[^>]*?>.*?</script>@si'); // Strip out javascript $var = preg_replace($search, "\n", html_entity_decode($var)); // Strip out javascript $linklabel = array(); $link = array(); $dom = new D...

Zend_Navigation with hidden pages

Hi, I have my Zend_Navigation loaded from a PHP array (but that's irrelevant...) and I'm using the navigation menu helper to generate a menu based on the loaded navigation. Some menu items must not appear in the outputted menu, so I simply set "'visible' => false" in my array for that page and there you go! But if the URL of an 'hidden' ...