Aside from the obvious (localhost, 127.0.0.1) does PHP (command line interface!) have a mechanism for discovering the IP of the computer the script is running on?
$SERVER[] will not work as this is not a Web app - this is a command line script.
TIA
...
<?php
//example code
$url = 'http://clients1.google.com/complete/search?hl=en&q=speed';
function processURL( $url )
{
$contents = file_get_contents( $url );
return $contents;
}
print_r( processURL($url) );
?>
Output:
window.google.ac.h(["speed",[["speed test","89,300,000 results","0"],["speed channel","76,100,000 results"...
If you have an array of ISO dates, how would you calculate the most days between two sequential dates from the array?
$array = array('2009-03-11', '2009-03-12', '2009-04-12', '2009-05-03', '2009-10-30');
I think I need a loop, some sort of iterating variable and a sort. I can't quite figure it out.
This is actually being output from M...
In php :: Please explain when i should use interface and when i should use abstract class? And how i can change my abstract class in to an interface?
...
Ok, I had a hard time coming up with a title, as you can probably tell. Anyway, I need to select 5 items from a DB excluding the first one. More specifically, I have items in a DB, each with a specific, auto-incrementing ID. I need to select the first 5 after the item with the highest ID. What would be the best way to do this? Thanks!
-...
I am trying to make some table out of a multidimensional array
here is my code
http://pastebin.com/d13d62098
I am getting this error
**Warning: Invalid argument supplied for foreach()
here is an example of the array
www.pastebin.com/m3454956a
any ideas?
...
I am adding the current date and time to my database using the following code:
$current_date_time = time();
echo date('n/j/y g:ia',$current_date_time);
It shows up as 11/29/09 12:38am when it should be 11/29/09 11:38am
The time is ahead by one hour. I am in the Pacific time zone and my hosting provider is in Utah, the Mountain Time...
How can I set my Iframe height to be dynamic to its content.
The content is only PHP code, nothing else.
I use the php to query database, and then show some ads. The more ads, the higher the iframe should be.
I thought height='100%' should do it, but no...
I have read other Q but their solutions doesn't work for me.
Suggestions ?
T...
What are the best PHP solutions for a blip.fm-like fixed audio player?
...
I have a form on my main page (main.html) with the target set to an iframe on that page. The action of the frame on the main page is a php file.
So, the php file displays in the iframe basically.
Now, I have this script in the php file to get height of content:
var x = document.body.scrollHeight;
window.parent.document.getelementbyid("...
I need to create a function for WP that will check if the current category is both child of X category and parent to Z category.
Ideas?
...
I am using PHP to query a mysql db.
After the query, I am using mysql_fetch_array in a while loop to display all results inside a table.
Now, depending on a variable ($adtypes) I want the query-results-array to change...
Explanation: ($query_results is the name of the array containing the query results,
basically something like SELEC...
I know there are more elegant ways to set up an html form to take the input of male or female; however, I am learning, and I was just wondering if this is also possible:
//Incorporate two checks
if (empty($_POST['sex'])==FALSE && sanityCheck($_POST['sex'], 'string', 1)==TRUE)
{
// if the checks are ok for sex we assign sex...
Hi,
I've written a method to set a header() to the appropriate file type of an upload stored in a database and then I would like to echo() the file.
The method is as follows inside a controller:
function view_upload( $id = 0 ) {
$id = $this->db->escape( $id );
$query = $this->db->query( "SELECT file_type FROM media WHERE id ...
I need to make snapshots of web pages programmatically using PHP and get them into a HTML E-Mail.
I tried wget --page-requisites. It downloads everything all right, but it doesn't change the HTML page's source code to point to the downloaded files rather than the on-line originals. Also, that HTML is of course a long way from being dis...
I'm wondering, how do you guys unit-test in CakePHP?
How do you incorporate tests in projects?
What parts of a project do you test? How do you decide which parts gets to be unit-tested?
Do you guys still get to finish the job before the deadline?
I'd really appreciate your answers. Thanks in advance!
...
I have:
class A{
public $name = 'A';
public $B;
public function B_into_A($b)
{
$this->B = $b;
}
}
class B{
public $name = 'B';
public $A;
public function new_A_into_B($a)
{
$this->A = new $a;
}
}
$a = new A;
$b = new B;
$a->B_into_A($b);
$b->new_A_into_B('A');
Is this a goo...
Hey guys.
I am trying to match the FDSize: in the following:
Gid: 48 48 48 48
FDSize: 64
Groups: 48 425
VmPeak: 289928 kB
It comes from /proc/status
is not fixied length, and neither is the lines above or below.
Can any one help?
Thanks
...
When I search the db for a certain value, say a singular noun like "party", I want to be able to get the value "party" from the db, even though it's actually "parties". For that I thought about replacing the -ies suffix for -y, which didn't have any conspicuous exceptions (maybe "lies").
Is there a MySQL equivalent to the PHP Preg_Repla...
Hey Everyone,
Just wondering can anyone tell me how to access the file field variable in drupal? I can access the rest of the node's variabels with the following php:
$node->field_event[0]['value'];
But I do not know how to access the content of a file field called field_pdf.
I know it is created with something like:
$node->field_p...