Hi,
This might be very easy to do, but I haven't been able to figure it out.
Basically, I have a loosely couple web-app written in python and php. The python code uses PHP sessions (generated from the PHP app when the user logs in) to check if the user is logged in/has permission to access the given python resource.
My question is thi...
I am aware that instanceof is an operator and that is_a is a method.
Is the method slower in performance? What would you prefer to use?
...
Hi,
I need to bea be able to use a static variable set in a class that extends a base class... from the base class.
Consider this:
class Animal {
public static $color = 'black';
public static function get_color()
{
return self::$color;
}
}
class Dog extends Animal {
public static $color = 'brown';
}
echo...
I have a Persons object. It has a variable name accessible by saying
$p = new Person('John');
echo $p->name;
Now I have a string.
$name = 'name';
I need to get $p->name using $p and $name. Something like
echo $p->[$name];
...
I tried:
$args = array(
'access_token' => $access_token,
'id' => $uid
);
$url = "https://graph.facebook.com/{$idPhoto}/tags";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOP...
On my Ubercart node-product.tpl.php page, I am trying to extract the individual product dimensions (height, weight, length) from the more generic: print $node->content['dimensions'] ['#value']; which returns "Dimensions: 72in. × 42in. × 30in."
Using var_dump(get_defined_vars()); I'm able to see that the dimensions are being outputted in...
I am trying to generate a Google Merchant RSS Feed, using PHP's SimpleXML and DOMDocument.
The actual generating code goes like that:
$dom = new DOMDocument('1.0', 'utf-8');
$dom->formatOutput = true;
$pRSS = $dom->createElement('rss');
$pRSS->setAttribute('version', '2.0');
$pRSS->setAttribute('xmlns:g', 'http://base.google.com/ns/1....
I have the following line of code:
<a href="javascript:;" onClick="tweeet('myid')">My Tweets!</a>
Now while this is working perfectly fine the following line is not:
<a href="javascript:;" onClick="tweeet(<?php echo 'myid'; ?>)">My Tweets!</a>
Can anyone help me out why it is not working and suggest any changes? The variable I wan...
I've stumbled recently upon a problem. I have several partial which are in several actions and have different way of displaying data, hence I used the contextual option in cache.yml as such :
_list:
enabled: true
contextual: true
Now I needed to remove the partial cache when the data was updated, which is normally pretty easy when...
i need a pattern which satisfies mysql field names, but also with the option of having a table name before it
examples:
mytable.myfield
myfield
my4732894__7289FiEld
here's what i tried:
$pattern = "/^[a-zA-Z0-9_]*?[\.[a-zA-Z0-9_]]?$/";
this worked for what i needed before, which was just the field name:
$pattern = "/^[a-zA-Z0-9_]...
Problem: I want to determine the original file creation time from a file uploaded to my server via PHP.
My understanding is that the file is copied from the client to a temporary file on my server, which then is referenced in the $_FILES var. The temporary file is of course of no use because it was just created. Is there any way I coul...
I have a zip file that is uploaded to my server daily. It seems that this zip file isn't formed properly because when I open it with my IZarc (my desktop zip application) it warns me that there is a bad zip header found. I can go ahead and open the file if I tell IZarc to go ahead and open it.
When I attempt to open the file with PHP li...
Possible Duplicate:
What is the PHP ? : operator called and what does it do?
I feed like a goof but I don't entirely understand what's happening in this code:
$var .= ($one || $two) ? function_one( $one, $another) : function_two( $two, $another);
Does that say if $one or $two then $var is equal to fuction_one(), else functi...
All,
I have a class function to interface with the RESTful API for Last.FM - its purpose is to grab the most recent tracks for my user. Here it is:
private static $base_url = 'http://ws.audioscrobbler.com/2.0/';
public static function getTopTracks($options = array())
{
$options = array_merge(array(
'user' => 'bachya',
'peri...
I use this php script to send an email. It works well, but german mutated vowels (ö,ä,ü, etc) are not displayed correctly. Any hints how to change that?
<?php
/* Geben Sie hier Ihre E-Mail Adresse zwischen den beiden " an: */
$_emails[0] = "[email protected]";
// Wenn keine $_POST Daten übermittelt wurden, dann abbrechen
if(!isset...
This is Drupal 6.x and am having a nightmare of a time to modify a simple drupal form. This is a module file.
function modulename_menu() {
$items = array();
$items['school/registration'] = array(
'title' => 'Registration Form',
'page callback' =>'drupal_get_form',
'type' => MENU_CALLBACK
);
return $items;
}...
I'm trying to write some simple php code that will make a post request and then retrieve a JSON result from the server.
It seemed simple to me, but the below code simply doesn't open a connection.
$port = 2057;
$path = "/validate/";
$request = "value1=somevalue&value2=somevalue&value3=somevalue";
$http_request = "POST $path HTTP/1.0\...
Hello, did you know a php script (a class will be nice) who get the url of the first image result of a google api image search? Thanks
Example.
<?php echo(geturl("searchterm")) ?>
...
I am new to FreshBooks (not only the API) and I want to use it for some automatically generated invoices. I was trying to run some of the source code examples (the PHP and JS libraries in particular):
http://developers.freshbooks.com/api/samplecode/
The problem is that I get an error message:
"Connection error"
Do I need to set up anyt...
I'm working on a simple JOIN of two tables (urls and companies). I am using this query call:
print $this->_db->select()->from(array('u' => 'urls'),
array('id', 'url', 'company_id'))
->join(array('c' => 'companies'),
'u.company_id = c.id');
whic...