php-general Digest 2 Sep 2008 14:23:37 -0000 Issue 5659

Topics (messages 279243 through 279275):

Re: newbie - PHP escaping trigger happy
        279243 by: Eric Butera

Re: Shared memory, mutex functionality and spawning threads. Is it possible 
using PHP?
        279244 by: Micah Gersten
        279246 by: Per Jessen
        279248 by: Colin Guthrie

Mozilla user agent escapes detection
        279245 by: Dave M G
        279249 by: Diogo Neves
        279250 by: Jochem Maas
        279252 by: Richard Heyes

Re: skinning a cat
        279247 by: Per Jessen
        279272 by: Robert Cummings
        279275 by: Per Jessen

Re: Individual bulk e-mails - performance question (was "skinning a cat") :-)
        279251 by: Jochem Maas

Google Chrome
        279253 by: Richard Heyes
        279254 by: Diogo Neves
        279255 by: Per Jessen
        279256 by: Richard Heyes
        279257 by: Stut
        279258 by: Per Jessen
        279259 by: Luke
        279260 by: shiplu
        279261 by: Per Jessen
        279262 by: Diogo Neves
        279263 by: Jochem Maas
        279264 by: Richard Heyes
        279265 by: Richard Heyes
        279266 by: Jochem Maas
        279267 by: Stut
        279273 by: Robert Cummings

geolocation
        279268 by: clive
        279269 by: Schiz0
        279270 by: Per Jessen
        279274 by: Jignesh Thummar

Re: Recommendation
        279271 by: Dan Joseph

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
On Mon, Sep 1, 2008 at 10:21 PM, Govinda <[EMAIL PROTECTED]> wrote:
> Just a quick Q, which I know has to be in the docs somewhere, but I haven't
> come across it yet-
>
> PHP automatically escaping single and double quotes...  how to turn it off?
>
> I.e.-
> in a form text input, someone inputs
> love's "influence" <grows>
>
> and on the posted page I get:
> love\'s \"influence\"
>
> WHen I wrap that with  htmlspecialchars , then I get:
> love\&#039;s \&quot;influence\&quot; &lt;grows&gt;
>
> What I want is:
> love&#039;s &quot;influence&quot;  &lt;grows&gt;
>
> ...in this case anyway.  Probably if I understood why PHP was escaping the
> quotes, then I likely would want that behavior in those circumstances it was
> designed for...  but not now, and I don't know how to turn it off.
>
> Thanks,
> -Govinda
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

http://us.php.net/magicquotes

--- End Message ---
--- Begin Message ---
http://us2.php.net/apc

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Kent Larsson wrote:
> Hi,
>
> Is it possible to have shared memory in the form of shared global variables
> in PHP? Or any other form of shared memory? And if that is the case, is
> there any form of mutex functionality which may be used to assure
> syncronized access to this memory?
>
> My next question is related to the first one.
>
> Is it possible to have a thread running for processing of information. This
> thread should be accessed from all the session instances, and it would also
> need to be syncronized. I would like to have something like:
> jobProcessorThread.addJob(aJobClassInstance)
>
> The job processor thread should work with the jobs in its queue until the
> queue is empty. Then it should idle until more requests are received.
>
> And my last question.
>
> Is it possible to let any code run and perform its work after PHP has sent
> the page to the user? This could be an alternative to having a worker thread
> in if it's also possible to have mutexes and shared memory. Then the worker
> thread jobs could be processed after a page has been sent inside a critical
> block protected by mutex functionality.
>
> Best regards,
> Kent
>
>   

--- End Message ---
--- Begin Message ---
Kent Larsson wrote:

> In absence of shared memory and threads. What I really must have is
> some kind of mutex functionality. I will be manipulating files on disk
> and I don't want two instances to be able to touch the disk at the
> same time. 

Touch the disk or touch the file?  I assume you meant the latter, i.e.
you don't want two instances to operate on the same file concurrently. 

> Is there something I could use for mutual exclusion? If 
> there aren't any dedicated methods, are there 100% reliable
> workarounds?

Look up file locking.  In fact, this was the topic of a very recent
thread.


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
Kent Larsson wrote:
Thank you for your answer. I was hoping there were a solution. :-/ It would
have been nice as PHP has a large install base and is a quite common element
in cheap web hosting solutions. Has anyone else got any more comments or
suggestions?

In absence of shared memory and threads. What I really must have is some
kind of mutex functionality. I will be manipulating files on disk and I
don't want two instances to be able to touch the disk at the same time. Is
there something I could use for mutual exclusion? If there aren't any
dedicated methods, are there 100% reliable workarounds?

If you are looking for shared memory such that one request can then access an object created once (e.g. "primed") and stored for subsequent reuse, then this is totally possible.

Using something like memcached or APC you can access such shared memory etc. Access to APC shared memory is protected using various locking methods, including File Locks (mmap), IPC Semaphores, Spinlocks and PThread Mutexs.

While you cannot run threads in a Web based environment very easily, you can fork child processes: http://uk.php.net/pcntl_fork. I'm not sure I'd recommend this for a web environment tho! Depending what you are doing tho' you may want to run a small "daemon" that listens for connections and spawns off a new process to deal with it via this method. It really depends what you are trying to achieve as all of the timing/locking problems of asynchronous programming are typically something I would try and avoid in a web/scripting environment.

HTHs

Col



--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]


--- End Message ---
--- Begin Message ---
PHP List,

I have a script, part of which is taken from a script I found on the 'net, which tries to detect the user agent of the browser accessing the site. One of the reasons I'm doing this is to find out if the browser is a desktop or mobile.

Part of the code looks like this:

$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
$isDesktop = (strpos($ua, 'firefox') !== false)
|| (strpos($ua,'mosaic') !== false)
|| (strpos($ua,'msie') !== false)
|| (strpos($ua,'opera') !== false)
|| (strpos($ua,'mozilla') !== false)
|| (strpos($ua,'w3c_css_validator') !== false)
|| (strpos($ua,'w3c_validator') !== false);

What's driving me crazy is that it successfully determines all the browsers listed there, *except* mozilla.

I have a log file which alerts me when an unknown browser comes through my site, and it's chock full of messages telling me that a Mozilla based browser has come by. There are a *lot* of Mozilla based browsers.

Some examples from my logs of the browsers slipping by my test:

HTTP_USER_AGENT: Mozilla/5.0 compatible; Yahoo! Slurp
HTTP_USER_AGENT: Mozilla/5.0 compatible; Googlebot/2.1
HTTP_USER_AGENT: Mozilla/5.0 X11; U; Linux i686

In each case, the strpos() should have seen the mozilla agent and not bothered logging it.

It's not complicated code, especially considering it's successfully finding msie and firefox.

I can't imagine why Mozilla would be different.

Any suggestions? Is there something about my code right in front of my face that I'm not seeing?

Any suggestions would be greatly appreciated.

Thanks.

--
Dave M G

--- End Message ---
--- Begin Message ---
On Tue, Sep 2, 2008 at 4:39 AM, Dave M G <[EMAIL PROTECTED]> wrote:

> PHP List,
>
> I have a script, part of which is taken from a script I found on the 'net,
> which tries to detect the user agent of the browser accessing the site. One
> of the reasons I'm doing this is to find out if the browser is a desktop or
> mobile.
>
> Part of the code looks like this:
>
> $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
> $isDesktop = (strpos($ua, 'firefox') !== false)
> || (strpos($ua,'mosaic') !== false)
> || (strpos($ua,'msie') !== false)
> || (strpos($ua,'opera') !== false)
> || (strpos($ua,'mozilla') !== false)
> || (strpos($ua,'w3c_css_validator') !== false)
> || (strpos($ua,'w3c_validator') !== false);
>
> What's driving me crazy is that it successfully determines all the browsers
> listed there, *except* mozilla.
>
> I have a log file which alerts me when an unknown browser comes through my
> site, and it's chock full of messages telling me that a Mozilla based
> browser has come by. There are a *lot* of Mozilla based browsers.
>
> Some examples from my logs of the browsers slipping by my test:
>
> HTTP_USER_AGENT: Mozilla/5.0 compatible; Yahoo! Slurp
> HTTP_USER_AGENT: Mozilla/5.0 compatible; Googlebot/2.1
> HTTP_USER_AGENT: Mozilla/5.0 X11; U; Linux i686
>
> In each case, the strpos() should have seen the mozilla agent and not
> bothered logging it.
>
> It's not complicated code, especially considering it's successfully finding
> msie and firefox.
>
> I can't imagine why Mozilla would be different.
>
> Any suggestions? Is there something about my code right in front of my face
> that I'm not seeing?
>
> Any suggestions would be greatly appreciated.
>
> Thanks.
>
> --
> Dave M G
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Unless you are not getting that useragents on your php, it as to work...
At least my test worked perfectly

<?php
var_dump( strpos( strtolower( 'Mozilla/5.0 compatible; Yahoo! Slurp' ),
'mozilla' ));
var_dump( strpos( strtolower( 'Mozilla/5.0 compatible; Yahoo! Slurp' ),
'mozilla' ) !== false );
var_dump( strpos( strtolower( 'Mozilla/5.0 compatible; Googlebot/2.1' ),
'mozilla' ));
var_dump( strpos( strtolower( 'Mozilla/5.0 compatible; Googlebot/2.1' ),
'mozilla' ) !== false );
var_dump( strpos( strtolower( 'Mozilla/5.0 X11; U; Linux i686' ), 'mozilla'
));
var_dump( strpos( strtolower( 'Mozilla/5.0 X11; U; Linux i686' ), 'mozilla'
) !== false );
?>


-- 
Thanks for your attention,

Diogo Neves
Web Developer @ SAPO.pt by PrimeIT.pt

--- End Message ---
--- Begin Message ---
Dave M G schreef:
PHP List,

I have a script, part of which is taken from a script I found on the 'net, which tries to detect the user agent of the browser accessing the site. One of the reasons I'm doing this is to find out if the browser is a desktop or mobile.

Part of the code looks like this:

$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
$isDesktop = (strpos($ua, 'firefox') !== false)
|| (strpos($ua,'mosaic') !== false)
|| (strpos($ua,'msie') !== false)
|| (strpos($ua,'opera') !== false)
|| (strpos($ua,'mozilla') !== false)
|| (strpos($ua,'w3c_css_validator') !== false)
|| (strpos($ua,'w3c_validator') !== false);

What's driving me crazy is that it successfully determines all the browsers listed there, *except* mozilla.

Mozilla !== mozilla

stripos is the case-insenstive version of strpos


I have a log file which alerts me when an unknown browser comes through my site, and it's chock full of messages telling me that a Mozilla based browser has come by. There are a *lot* of Mozilla based browsers.

Some examples from my logs of the browsers slipping by my test:

HTTP_USER_AGENT: Mozilla/5.0 compatible; Yahoo! Slurp
HTTP_USER_AGENT: Mozilla/5.0 compatible; Googlebot/2.1

these 2 are bots btw.

HTTP_USER_AGENT: Mozilla/5.0 X11; U; Linux i686

In each case, the strpos() should have seen the mozilla agent and not bothered logging it.

It's not complicated code, especially considering it's successfully finding msie and firefox.

I can't imagine why Mozilla would be different.

Any suggestions? Is there something about my code right in front of my face that I'm not seeing?

Any suggestions would be greatly appreciated.

STW? plenty of people offering code that attempts to detect mobile devices, 
e.g.:

http://www.andymoore.info/php-to-detect-mobile-phones/

also I'd offer a link in the top of your site pointing to the mobile site
(and vice-versa) in order to:

1. allow bots to visit both.
2. in case your code guessed incorrectly for some user(s)

I'd also check the UA string specifically for bots first and just let them
through ... they are neither desktop nor mobile browsers.

additionally you might consider how you want to accomodate text browsers
(which is kind of what a bot is)


Thanks.



--- End Message ---
--- Begin Message ---
> I have a script, part of which is taken from a script I found on the 'net,
> which tries to detect the user agent of the browser accessing the site. One
> of the reasons I'm doing this is to find out if the browser is a desktop or
> mobile.

Try another detection script. Eg my own:

http://www.phpguru.org/static/browser.html

Or the Javascript version it stems from. Or...

-- 
Richard Heyes

HTML5 Graphing for IE7, FF, Opera and Safari:
http://www.phpguru.org/RGraph

--- End Message ---
--- Begin Message ---
Lupus Michaelis wrote:

> Robert Cummings a écrit :
> 
>> Try running that on windows.
> 
>    No problem
> <http://technet.microsoft.com/en-us/interopmigration/bb380242.aspx>
> 

And of course, there's also Cygwin. 


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
On Tue, 2008-09-02 at 07:52 +0200, Per Jessen wrote:
> Lupus Michaelis wrote:
> 
> > Robert Cummings a écrit :
> > 
> >> Try running that on windows.
> > 
> >    No problem
> > <http://technet.microsoft.com/en-us/interopmigration/bb380242.aspx>
> > 
> 
> And of course, there's also Cygwin.

*lol* And I quote:

    Per Jessen said:
    "I'm probably old fashioned, but to me all that stuff is way
     overkill."

And now your suggesting installing cygwin to accomplish something so
easily accomplished in PHP.

Yeesh.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
Robert Cummings wrote:

> On Tue, 2008-09-02 at 07:52 +0200, Per Jessen wrote:
>> Lupus Michaelis wrote:
>> 
>> > Robert Cummings a écrit :
>> > 
>> >> Try running that on windows.
>> > 
>> >    No problem
>> > <http://technet.microsoft.com/en-us/interopmigration/bb380242.aspx>
>> > 
>> 
>> And of course, there's also Cygwin.
> 
> *lol* And I quote:
> 
>     Per Jessen said:
>     "I'm probably old fashioned, but to me all that stuff is way
>      overkill."
> 
> And now your suggesting installing cygwin to accomplish something so
> easily accomplished in PHP.
> 
> Yeesh.

Rob, I've never suggested anything like that.  But if you were to ask me
how to get a fairly decent Unix-like environment on a Windows platform,
yes, I would suggest using Cygwin.


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
Robert Cummings schreef:
On Mon, 2008-09-01 at 14:34 +0200, Merlin Morgenstern wrote:
Per Jessen schrieb:
Jochem Maas wrote:

lockfile=/var/lock/<xxxx>/file
# clear out a lock older than 60mins
find $lockfile -cmin +60 | xargs rm
test ! -f $lockfile && (
touch $lockfile
<run some php>
rm -f $lockfile
)
wouldn't creating a dir be better here? (with regard to atomicity)

I haven't thought it through, but I don't think it would change
anything.

/Per Jessen, Zürich

Hello everybody,

thank you for the huge amount of replies on my question. I believe I quite lost a bit track on how to solve the problem hands on. To summerize, there are aparently two ways of skinning the cat :-)

1. Run a deamon
I admit I have never wrote one, and that seems therefore to be the harder option for me. Well... perhaps not. I assume it is simply creating a shell script like Jochem wrote, however I guess it would just take longer for me to get it running as I have never done that before.

It was Per who posted that script, I merely asked him for clarification ...
it's actually an easy script to implement ... you just about only have
to change one line (the line that runs your cron script) ... and then have
crom run the shell script as opposed to your script directly.


2. Create a PHP file that holds some lock code which is triggered by CRON every 5 minutes. Taking the example from Robert.

3. Following idea which I am now actually implementing :-)

  - Add all emails into a mysql db with one insert command.
  - Run a php script by cron every 5 min that does the following:
        - update table, set session_id = x on all entries without session id
        - get all entries with that session ID
        - send email to those with that session ID
        - remove all entries with that session ID

Looks like easies sollution on how to skimm the cat. DB might not be the most performing sollution, but sufficient considering the hard ware power.

Actually 3 was what I suggested with a lock mechanism to ensure that if
your script run by cron takes longer than 5 minutes that you don't have
two scritps stepping on each others' toes.

Cheers,
Rob.


--- End Message ---
--- Begin Message ---
Hi,

Looks like Google chrome is being released today (or soon). IE,
Firefox, Opera, Safari and now Chrome, hmmm, can anyone say "browser
war"?

http://www.google.com/googlebooks/chrome/

-- 
Richard Heyes

HTML5 Graphing for IE7, FF, Opera and Safari:
http://www.phpguru.org/RGraph

--- End Message ---
--- Begin Message ---
On Tue, Sep 2, 2008 at 12:21 PM, Richard Heyes <[EMAIL PROTECTED]> wrote:

> Hi,
>
> Looks like Google chrome is being released today (or soon). IE,
> Firefox, Opera, Safari and now Chrome, hmmm, can anyone say "browser
> war"?
>
> http://www.google.com/googlebooks/chrome/
>
> --
> Richard Heyes
>
> HTML5 Graphing for IE7, FF, Opera and Safari:
> http://www.phpguru.org/RGraph
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Hi,
I have nothing against browsers, but that discussion is (maybe) better on a
javascript/designer/whatever mailling...
And it's only rumors... why not wait by the real thing is out?

-- 
Thanks for your attention,

Diogo Neves
Web Developer @ SAPO.pt by PrimeIT.pt

--- End Message ---
--- Begin Message ---
Richard Heyes wrote:

> Hi,
> 
> Looks like Google chrome is being released today (or soon). IE,
> Firefox, Opera, Safari and now Chrome, hmmm, can anyone say "browser
> war"?
> 

Can anyone say "even more money & effort wasted on testing
webpages" .... :-(


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
> why not wait by the real thing is out?

By the looks of it, the release is imminent.

-- 
Richard Heyes

HTML5 Graphing for IE7, FF, Opera and Safari:
http://www.phpguru.org/RGraph

--- End Message ---
--- Begin Message ---
On 2 Sep 2008, at 12:34, Per Jessen wrote:
Richard Heyes wrote:
Hi,

Looks like Google chrome is being released today (or soon). IE,
Firefox, Opera, Safari and now Chrome, hmmm, can anyone say "browser
war"?


Can anyone say "even more money & effort wasted on testing
webpages" .... :-(

Webkit-based, so no need to add any more testing than you do now.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
Stut wrote:

> On 2 Sep 2008, at 12:34, Per Jessen wrote:
>> Richard Heyes wrote:
>>> Hi,
>>>
>>> Looks like Google chrome is being released today (or soon). IE,
>>> Firefox, Opera, Safari and now Chrome, hmmm, can anyone say "browser
>>> war"?
>>>
>>
>> Can anyone say "even more money & effort wasted on testing
>> webpages" .... :-(
> 
> Webkit-based, so no need to add any more testing than you do now.
> 

I can't help thinking that sounds just like when MS is telling us they
are compatible.  But it _is_ good that they're using Webkit, I'm just
not sure if it really means no extra testing effort.  FF3 wasn't and
isn't compatible with FF2. 


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
isn't the webkit based on KHTML?

2008/9/2 Stut <[EMAIL PROTECTED]>

> On 2 Sep 2008, at 12:34, Per Jessen wrote:
>
>> Richard Heyes wrote:
>>
>>> Hi,
>>>
>>> Looks like Google chrome is being released today (or soon). IE,
>>> Firefox, Opera, Safari and now Chrome, hmmm, can anyone say "browser
>>> war"?
>>>
>>>
>> Can anyone say "even more money & effort wasted on testing
>> webpages" .... :-(
>>
>
> Webkit-based, so no need to add any more testing than you do now.
>
> -Stut
>
> --
> http://stut.net/
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Luke Slater

--- End Message ---
--- Begin Message ---
Google Chrome is not released yet, is it?
Didn't get any download link. :-S

-- 
A K M Mokaddim
http://talk.cmyweb.net
http://twitter.com/shiplu
Stop Top Posting !!

--- End Message ---
--- Begin Message ---
Luke wrote:

> isn't the webkit based on KHTML?
> 

It's a fork of KHTML, yes.  


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
On Tue, Sep 2, 2008 at 12:44 PM, shiplu <[EMAIL PROTECTED]> wrote:

> Google Chrome is not released yet, is it?
> Didn't get any download link. :-S
>

Was what i said... it's a rumor... let da thing came out and u'll see your
websites after...

>
> --
> A K M Mokaddim
> http://talk.cmyweb.net
> http://twitter.com/shiplu
> Stop Top Posting !!
>



-- 
Thanks for your attention,

Diogo Neves
Web Developer @ SAPO.pt by PrimeIT.pt

--- End Message ---
--- Begin Message ---
Richard Heyes schreef:
Hi,

Looks like Google chrome is being released today (or soon). IE,
Firefox, Opera, Safari and now Chrome, hmmm, can anyone say "browser
war"?

http://www.google.com/googlebooks/chrome/

to quote Han Solo :  "I have a bad feeling about this"




--- End Message ---
--- Begin Message ---
>> Can anyone say "even more money & effort wasted on testing
>> webpages" .... :-(
>
> Webkit-based, so no need to add any more testing than you do now.

Are you going to take the gamble? :-)

-- 
Richard Heyes

HTML5 Graphing for IE7, FF, Opera and Safari:
http://www.phpguru.org/RGraph

--- End Message ---
--- Begin Message ---
> Google Chrome is not released yet, is it?
> Didn't get any download link. :-S

Can't find any download link. It maybe a few hours away.

http://news.cnet.com/8301-17939_109-10030025-2.html

-- 
Richard Heyes

HTML5 Graphing for IE7, FF, Opera and Safari:
http://www.phpguru.org/RGraph

--- End Message ---
--- Begin Message ---
Richard Heyes schreef:
Hi,

Looks like Google chrome is being released today (or soon). IE,
Firefox, Opera, Safari and now Chrome, hmmm, can anyone say "browser
war"?

http://www.google.com/googlebooks/chrome/

I've been reading this ... very well done all in all, on page 37 they
say "But Google lives on the internet. It's in our interest to make the
internet better and without competition we have stagnation"

... funny that, make me think of the online ad market ;-)




--- End Message ---
--- Begin Message ---
On 2 Sep 2008, at 12:59, Richard Heyes wrote:
Can anyone say "even more money & effort wasted on testing
webpages" .... :-(

Webkit-based, so no need to add any more testing than you do now.

Are you going to take the gamble? :-)

I'll decide when I can play with it and the official announcement spells out what they've modified.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
On Tue, 2008-09-02 at 12:36 +0100, Stut wrote:
> On 2 Sep 2008, at 12:34, Per Jessen wrote:
> > Richard Heyes wrote:
> >> Hi,
> >>
> >> Looks like Google chrome is being released today (or soon). IE,
> >> Firefox, Opera, Safari and now Chrome, hmmm, can anyone say "browser
> >> war"?
> >>
> >
> > Can anyone say "even more money & effort wasted on testing
> > webpages" .... :-(
> 
> Webkit-based, so no need to add any more testing than you do now.

You must not remember IE 5.5 on IE and IE 5.5 on Mac. They were quite
different in annoying little places.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
Hi,

Have any developed a site that determines a users location based on IP address, Im not looking for accurate locations, just what country they are coming from.

I know I could possible get a list of IP blocks allocated to countries or make use of some web server to get the information, I just want to know how others are doing this?

If are using a specific method and know it to be robust and up to date please let me know.

Thanks

clive


--- End Message ---
--- Begin Message ---
On Tue, Sep 2, 2008 at 9:05 AM, clive <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Have any developed a site that determines a users location based on IP
>  address, Im not looking for accurate locations, just what country they are
> coming from.
>
> I know I could possible get a list of IP blocks allocated to countries or
> make use of some web server to get the information, I just want to know how
> others are doing this?
>
> If are using a specific method and know it to be robust and up to date
> please let me know.
>
> Thanks
>
> clive
>
>

I use the GeoIP libraries. They work perfectly. YOu just need to
install the pecl-GeoIP package, then make sure you keep the binary
database up-to-date (from www.maxmind.com).

http://php.net/geoip

--- End Message ---
--- Begin Message ---
clive wrote:

> Hi,
> 
> Have any developed a site that determines a users location based on IP
> address, Im not looking for accurate locations, just what country they
> are coming from.
> 

We use the information from  http://countries.nerd.dk/ - it's a simple
DNS lookup.


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
You can use this one also http://ip-to-country.webhosting.info/
This is being used by php.net site - to find country specific mirror.

You can get sample code here :
http://www.ruturaj.net/tutorials/php/ip-to-country

Regards,
Jignesh


On Tue, Sep 2, 2008 at 2:18 PM, Per Jessen <[EMAIL PROTECTED]> wrote:

> clive wrote:
>
> > Hi,
> >
> > Have any developed a site that determines a users location based on IP
> > address, Im not looking for accurate locations, just what country they
> > are coming from.
> >
>
> We use the information from  http://countries.nerd.dk/ - it's a simple
> DNS lookup.
>
>
> /Per Jessen, Zürich
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On Sat, Aug 30, 2008 at 8:38 AM, tedd <[EMAIL PROTECTED]> wrote:

> Hi gang:
>
> At 1:16 PM +0100 8/30/08, Stut wrote:
>
>> Now, about that recommendation for my linked in profile... ;)
>>
>
> That's not a bad idea. Daniel and I did an exchange a while back. I think
> it might help to land clients if we can use our linked-in status in some
> way. I haven't done that yet, but there should be a way.
>
> As such, if any of the regulars to this list are in need of a
> recommendation, please contact me off-list.
>
> Cheers,
>
> tedd
>
> --
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
We have threads that go 100+, and this one dies at 3...

You can view mine at http://www.linkedin.com/in/danjoseph

Anyone can feel free to connect to me as well, and I'd be happy to give
recommendations.

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."

--- End Message ---

Reply via email to