php-general Digest 25 Nov 2010 21:45:38 -0000 Issue 7054
Topics (messages 309658 through 309675):
any way to iterate the fields in a class
309658 by: ФêÏ
309664 by: Tommy Pham
Re: Spoofing user_agent
309659 by: Ron Piggott
309660 by: [email protected]
309661 by: Ron Piggott
309662 by: Shreyas Agasthya
309663 by: Ron Piggott
309665 by: Ron Piggott
309667 by: Shreyas Agasthya
309668 by: Deva
309671 by: Richard Quadling
309672 by: Ron Piggott
Re: Suppressing error from displaying
309666 by: Richard Quadling
Re: rewriteTextLinks.php - make URLs in plain text clickable
309669 by: Sky Gunning
Re: Can't find existing file
309670 by: Richard Quadling
309673 by: Bastien Koert
309674 by: Tommy Pham
309675 by: Tamara Temple
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 ---
Actually, what I am seeking is how to assign values to the fields in a class
via an array.
I have tried like this. However failed.
I have a class.
*class book{
var name;*
*var price;*
*}*
*
*
And I have got an array.
*$array=array('name'=>'harry potter','price'=>'$122');*
By using function *extract(), *I assign the values to $name and $price while
not $this->name and $this->price, which is not what I want.
So I am thinking iterating the fields in an array and assign the values each
by each through an array.
Is there any way to assign values to the fields in a class via an array.
Thanks in advance!
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: 肖羗 [mailto:[email protected]]
> Sent: Thursday, November 25, 2010 12:21 AM
> To: [email protected]
> Subject: [PHP]any way to iterate the fields in a class
>
> Actually, what I am seeking is how to assign values to the fields in a
class via
> an array.
> I have tried like this. However failed.
> I have a class.
> *class book{
> var name;*
> *var price;*
> *}*
> *
> *
> And I have got an array.
>
> *$array=array('name'=>'harry potter','price'=>'$122');*
>
> By using function *extract(), *I assign the values to $name and $price
while
> not $this->name and $this->price, which is not what I want.
>
> So I am thinking iterating the fields in an array and assign the values
each by
> each through an array.
>
> Is there any way to assign values to the fields in a class via an array.
>
> Thanks in advance!
Look into reflection [1]. Or you can just $bookObject = (object) $array;
Note: $bookObject != new BookClass().
Regards,
Tommy
[1] http://www.php.net/manual/en/book.reflection.php
--- End Message ---
--- Begin Message ---
I have wrote a script to generate a sitemap of my web site. It crawls all of
the site web pages. (About 30,000)
I need help to spoof the user_agent variable so the stats program running in
the background ( “AWSTATS” ) will treat the crawl as a bot, not browsing usage.
The sitemap generator is a cron job. I tried the syntax:
ini_set('user_agent', 'RonBot (http://www.theverseoftheday.info)'/);
This didn’t work. The browsing was attributed to the dedicated IP address.
How do I get AWSTATS to access this, such as other entries under the
“Robots/Spiders visitors” heading:
Unknown robot (identified by 'bot*')
I don’t mean any ill will by changing this setting. Thanks for the help.
Ron
The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info
--- End Message ---
--- Begin Message ---
You need to set it in the header request you make. Putting it in the script
you're using as a spider with ini_set won't do anything because the Target site
doesn't know anything about it.
Thanks,
Ash
http://www.ashleysheridan.co.uk
----- Reply message -----
From: "Ron Piggott" <[email protected]>
Date: Thu, Nov 25, 2010 08:25
Subject: [PHP] Fw: Spoofing user_agent
To: <[email protected]>
I have wrote a script to generate a sitemap of my web site. It crawls all of
the site web pages. (About 30,000)
I need help to spoof the user_agent variable so the stats program running in
the background ( “AWSTATS” ) will treat the crawl as a bot, not browsing usage.
The sitemap generator is a cron job. I tried the syntax:
ini_set('user_agent', 'RonBot (http://www.theverseoftheday.info)'/);
This didn’t work. The browsing was attributed to the dedicated IP address.
How do I get AWSTATS to access this, such as other entries under the
“Robots/Spiders visitors” heading:
Unknown robot (identified by 'bot*')
I don’t mean any ill will by changing this setting. Thanks for the help.
Ron
The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info
--- End Message ---
--- Begin Message ---
Is this what you are telling me to do:
header('user_agent: RonBot (http://www.theverseoftheday.info)');
Ron
The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info
From: [email protected]
Sent: Thursday, November 25, 2010 3:34 AM
To: Ron Piggott ; [email protected]
Subject: Re: [PHP] Fw: Spoofing user_agent
You need to set it in the header request you make. Putting it in the script
you're using as a spider with ini_set won't do anything because the Target site
doesn't know anything about it.
Thanks,
Ash
http://www.ashleysheridan.co.uk
----- Reply message -----
From: "Ron Piggott" <[email protected]>
Date: Thu, Nov 25, 2010 08:25
Subject: [PHP] Fw: Spoofing user_agent
To: <[email protected]>
I have wrote a script to generate a sitemap of my web site. It crawls all of
the site web pages. (About 30,000)
I need help to spoof the user_agent variable so the stats program running in
the background ( “AWSTATS” ) will treat the crawl as a bot, not browsing usage.
The sitemap generator is a cron job. I tried the syntax:
ini_set('user_agent', 'RonBot (http://www.theverseoftheday.info)/'/);
This didn’t work. The browsing was attributed to the dedicated IP address.
How do I get AWSTATS to access this, such as other entries under the
“Robots/Spiders visitors” heading:
Unknown robot (identified by 'bot*')
I don’t mean any ill will by changing this setting. Thanks for the help.
Ron
The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info
--- End Message ---
--- Begin Message ---
A standard HTTP Request headers is : User Agent (without the underscore).
--Shreyas
On Thu, Nov 25, 2010 at 2:36 PM, Ron Piggott <[email protected]
> wrote:
>
> Is this what you are telling me to do:
>
> header('user_agent: RonBot (http://www.theverseoftheday.info)');
>
> Ron
>
> The Verse of the Day
> “Encouragement from God’s Word”
> http://www.TheVerseOfTheDay.info
>
> From: [email protected]
> Sent: Thursday, November 25, 2010 3:34 AM
> To: Ron Piggott ; [email protected]
> Subject: Re: [PHP] Fw: Spoofing user_agent
>
> You need to set it in the header request you make. Putting it in the script
> you're using as a spider with ini_set won't do anything because the Target
> site doesn't know anything about it.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
> ----- Reply message -----
> From: "Ron Piggott" <[email protected]>
> Date: Thu, Nov 25, 2010 08:25
> Subject: [PHP] Fw: Spoofing user_agent
> To: <[email protected]>
>
> I have wrote a script to generate a sitemap of my web site. It crawls all
> of the site web pages. (About 30,000)
>
> I need help to spoof the user_agent variable so the stats program running
> in the background ( “AWSTATS” ) will treat the crawl as a bot, not browsing
> usage.
>
> The sitemap generator is a cron job. I tried the syntax:
> ini_set('user_agent', 'RonBot (http://www.theverseoftheday.info)/'/);
>
> This didn’t work. The browsing was attributed to the dedicated IP address.
>
> How do I get AWSTATS to access this, such as other entries under the
> “Robots/Spiders visitors” heading:
> Unknown robot (identified by 'bot*')
>
> I don’t mean any ill will by changing this setting. Thanks for the help.
>
> Ron
>
> The Verse of the Day
> “Encouragement from God’s Word”
> http://www.TheVerseOfTheDay.info
>
>
--
Regards,
Shreyas Agasthya
--- End Message ---
--- Begin Message ---
Thanks. Ron
The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info
From: Shreyas Agasthya
Sent: Thursday, November 25, 2010 4:21 AM
To: Ron Piggott
Cc: [email protected] ; [email protected]
Subject: Re: [PHP] Fw: Spoofing user_agent
A standard HTTP Request headers is : User Agent (without the underscore).
--Shreyas
On Thu, Nov 25, 2010 at 2:36 PM, Ron Piggott <[email protected]>
wrote:
Is this what you are telling me to do:
header('user_agent: RonBot (http://www.theverseoftheday.info)');
Ron
The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info
From: [email protected]
Sent: Thursday, November 25, 2010 3:34 AM
To: Ron Piggott ; [email protected]
Subject: Re: [PHP] Fw: Spoofing user_agent
You need to set it in the header request you make. Putting it in the script
you're using as a spider with ini_set won't do anything because the Target site
doesn't know anything about it.
Thanks,
Ash
http://www.ashleysheridan.co.uk
----- Reply message -----
From: "Ron Piggott" <[email protected]>
Date: Thu, Nov 25, 2010 08:25
Subject: [PHP] Fw: Spoofing user_agent
To: <[email protected]>
I have wrote a script to generate a sitemap of my web site. It crawls all of
the site web pages. (About 30,000)
I need help to spoof the user_agent variable so the stats program running in
the background ( “AWSTATS” ) will treat the crawl as a bot, not browsing usage.
The sitemap generator is a cron job. I tried the syntax:
ini_set('user_agent', 'RonBot (http://www.theverseoftheday.info)/'/);
This didn’t work. The browsing was attributed to the dedicated IP address.
How do I get AWSTATS to access this, such as other entries under the
“Robots/Spiders visitors” heading:
Unknown robot (identified by 'bot*')
I don’t mean any ill will by changing this setting. Thanks for the help.
Ron
The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info
--
Regards,
Shreyas Agasthya
--- End Message ---
--- Begin Message ---
Will the header pass with using file_get_contents , or should I be using
another command, and if so, which one? Ron
<?php
header('User Agent: RonBot (http://www.example.com)');
$url = "http://www.example.com";
$input = file_get_contents($url);
The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info
From: Shreyas Agasthya
Sent: Thursday, November 25, 2010 4:21 AM
To: Ron Piggott
Cc: [email protected] ; [email protected]
Subject: Re: [PHP] Fw: Spoofing user_agent
A standard HTTP Request headers is : User Agent (without the underscore).
--Shreyas
On Thu, Nov 25, 2010 at 2:36 PM, Ron Piggott <[email protected]>
wrote:
Is this what you are telling me to do:
header('user_agent: RonBot (http://www.theverseoftheday.info)');
Ron
The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info
From: [email protected]
Sent: Thursday, November 25, 2010 3:34 AM
To: Ron Piggott ; [email protected]
Subject: Re: [PHP] Fw: Spoofing user_agent
You need to set it in the header request you make. Putting it in the script
you're using as a spider with ini_set won't do anything because the Target site
doesn't know anything about it.
Thanks,
Ash
http://www.ashleysheridan.co.uk
----- Reply message -----
From: "Ron Piggott" <[email protected]>
Date: Thu, Nov 25, 2010 08:25
Subject: [PHP] Fw: Spoofing user_agent
To: <[email protected]>
I have wrote a script to generate a sitemap of my web site. It crawls all of
the site web pages. (About 30,000)
I need help to spoof the user_agent variable so the stats program running in
the background ( “AWSTATS” ) will treat the crawl as a bot, not browsing usage.
The sitemap generator is a cron job. I tried the syntax:
ini_set('user_agent', 'RonBot (http://www.theverseoftheday.info)/'/);
This didn’t work. The browsing was attributed to the dedicated IP address.
How do I get AWSTATS to access this, such as other entries under the
“Robots/Spiders visitors” heading:
Unknown robot (identified by 'bot*')
I don’t mean any ill will by changing this setting. Thanks for the help.
Ron
The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info
--
Regards,
Shreyas Agasthya
--- End Message ---
--- Begin Message ---
I feel you should use more of the 4th method here as you are not trying to
read the file but the header level (7th layer) information of the HTTP
protocol.
http://php.net/manual/en/function.file-get-contents.php
--Shreyas
On Thu, Nov 25, 2010 at 4:11 PM, Ron Piggott <[email protected]
> wrote:
> Will the header pass with using file_get_contents , or should I be using
> another command, and if so, which one? Ron
>
> <?php
>
> header('User Agent: RonBot (http://www.example.com)');
> $url = "http://www.example.com"; <http://www.example.com%22;>
>
> $input = file_get_contents($url);
>
>
>
> The Verse of the Day
> “Encouragement from God’s Word”
> http://www.TheVerseOfTheDay.info
>
> *From:* Shreyas Agasthya <[email protected]>
> *Sent:* Thursday, November 25, 2010 4:21 AM
> *To:* Ron Piggott <[email protected]>
> *Cc:* [email protected] ; [email protected]
> *Subject:* Re: [PHP] Fw: Spoofing user_agent
>
> A standard HTTP Request headers is : User Agent (without the underscore).
>
> --Shreyas
>
> On Thu, Nov 25, 2010 at 2:36 PM, Ron Piggott <
> [email protected]> wrote:
>
>>
>> Is this what you are telling me to do:
>>
>> header('user_agent: RonBot (http://www.theverseoftheday.info)');
>>
>> Ron
>>
>> The Verse of the Day
>> “Encouragement from God’s Word”
>> http://www.TheVerseOfTheDay.info
>>
>> From: [email protected]
>> Sent: Thursday, November 25, 2010 3:34 AM
>> To: Ron Piggott ; [email protected]
>> Subject: Re: [PHP] Fw: Spoofing user_agent
>>
>> You need to set it in the header request you make. Putting it in the
>> script you're using as a spider with ini_set won't do anything because the
>> Target site doesn't know anything about it.
>>
>> Thanks,
>> Ash
>> http://www.ashleysheridan.co.uk
>>
>> ----- Reply message -----
>> From: "Ron Piggott" <[email protected]>
>> Date: Thu, Nov 25, 2010 08:25
>> Subject: [PHP] Fw: Spoofing user_agent
>> To: <[email protected]>
>>
>> I have wrote a script to generate a sitemap of my web site. It crawls all
>> of the site web pages. (About 30,000)
>>
>> I need help to spoof the user_agent variable so the stats program running
>> in the background ( “AWSTATS” ) will treat the crawl as a bot, not browsing
>> usage.
>>
>> The sitemap generator is a cron job. I tried the syntax:
>> ini_set('user_agent', 'RonBot (http://www.theverseoftheday.info)/'/);
>>
>> This didn’t work. The browsing was attributed to the dedicated IP
>> address.
>>
>> How do I get AWSTATS to access this, such as other entries under the
>> “Robots/Spiders visitors” heading:
>> Unknown robot (identified by 'bot*')
>>
>> I don’t mean any ill will by changing this setting. Thanks for the help.
>>
>> Ron
>>
>> The Verse of the Day
>> “Encouragement from God’s Word”
>> http://www.TheVerseOfTheDay.info
>>
>>
>
>
> --
> Regards,
> Shreyas Agasthya
>
--
Regards,
Shreyas Agasthya
--- End Message ---
--- Begin Message ---
Use curl
http://php.net/manual/en/book.curl.php
On Thu, Nov 25, 2010 at 4:41 PM, Shreyas Agasthya <[email protected]>wrote:
> I feel you should use more of the 4th method here as you are not trying to
> read the file but the header level (7th layer) information of the HTTP
> protocol.
>
> http://php.net/manual/en/function.file-get-contents.php
>
>
> --Shreyas
>
> On Thu, Nov 25, 2010 at 4:11 PM, Ron Piggott <
> [email protected]
> > wrote:
>
> > Will the header pass with using file_get_contents , or should I be
> using
> > another command, and if so, which one? Ron
> >
> > <?php
> >
> > header('User Agent: RonBot (http://www.example.com)');
> > $url = "http://www.example.com"; <http://www.example.com%22;>
> >
> > $input = file_get_contents($url);
> >
> >
> >
> > The Verse of the Day
> > “Encouragement from God’s Word”
> > http://www.TheVerseOfTheDay.info
> >
> > *From:* Shreyas Agasthya <[email protected]>
> > *Sent:* Thursday, November 25, 2010 4:21 AM
> > *To:* Ron Piggott <[email protected]>
> > *Cc:* [email protected] ; [email protected]
> > *Subject:* Re: [PHP] Fw: Spoofing user_agent
> >
> > A standard HTTP Request headers is : User Agent (without the underscore).
> >
> > --Shreyas
> >
> > On Thu, Nov 25, 2010 at 2:36 PM, Ron Piggott <
> > [email protected]> wrote:
> >
> >>
> >> Is this what you are telling me to do:
> >>
> >> header('user_agent: RonBot (http://www.theverseoftheday.info)');
> >>
> >> Ron
> >>
> >> The Verse of the Day
> >> “Encouragement from God’s Word”
> >> http://www.TheVerseOfTheDay.info
> >>
> >> From: [email protected]
> >> Sent: Thursday, November 25, 2010 3:34 AM
> >> To: Ron Piggott ; [email protected]
> >> Subject: Re: [PHP] Fw: Spoofing user_agent
> >>
> >> You need to set it in the header request you make. Putting it in the
> >> script you're using as a spider with ini_set won't do anything because
> the
> >> Target site doesn't know anything about it.
> >>
> >> Thanks,
> >> Ash
> >> http://www.ashleysheridan.co.uk
> >>
> >> ----- Reply message -----
> >> From: "Ron Piggott" <[email protected]>
> >> Date: Thu, Nov 25, 2010 08:25
> >> Subject: [PHP] Fw: Spoofing user_agent
> >> To: <[email protected]>
> >>
> >> I have wrote a script to generate a sitemap of my web site. It crawls
> all
> >> of the site web pages. (About 30,000)
> >>
> >> I need help to spoof the user_agent variable so the stats program
> running
> >> in the background ( “AWSTATS” ) will treat the crawl as a bot, not
> browsing
> >> usage.
> >>
> >> The sitemap generator is a cron job. I tried the syntax:
> >> ini_set('user_agent', 'RonBot (http://www.theverseoftheday.info)/'/);
> >>
> >> This didn’t work. The browsing was attributed to the dedicated IP
> >> address.
> >>
> >> How do I get AWSTATS to access this, such as other entries under the
> >> “Robots/Spiders visitors” heading:
> >> Unknown robot (identified by 'bot*')
> >>
> >> I don’t mean any ill will by changing this setting. Thanks for the
> help.
> >>
> >> Ron
> >>
> >> The Verse of the Day
> >> “Encouragement from God’s Word”
> >> http://www.TheVerseOfTheDay.info
> >>
> >>
> >
> >
> > --
> > Regards,
> > Shreyas Agasthya
> >
>
>
>
> --
> Regards,
> Shreyas Agasthya
>
--
:DJ
--- End Message ---
--- Begin Message ---
On 25 November 2010 11:32, Deva <[email protected]> wrote:
> Use curl
> http://php.net/manual/en/book.curl.php
>
>
> On Thu, Nov 25, 2010 at 4:41 PM, Shreyas Agasthya <[email protected]>wrote:
>
>> I feel you should use more of the 4th method here as you are not trying to
>> read the file but the header level (7th layer) information of the HTTP
>> protocol.
>>
>> http://php.net/manual/en/function.file-get-contents.php
>>
>>
>> --Shreyas
>>
>> On Thu, Nov 25, 2010 at 4:11 PM, Ron Piggott <
>> [email protected]
>> > wrote:
>>
>> > Will the header pass with using file_get_contents , or should I be
>> using
>> > another command, and if so, which one? Ron
>> >
>> > <?php
>> >
>> > header('User Agent: RonBot (http://www.example.com)');
>> > $url = "http://www.example.com"; <http://www.example.com%22;>
>> >
>> > $input = file_get_contents($url);
>> >
>> >
>> >
>> > The Verse of the Day
>> > “Encouragement from God’s Word”
>> > http://www.TheVerseOfTheDay.info
>> >
>> > *From:* Shreyas Agasthya <[email protected]>
>> > *Sent:* Thursday, November 25, 2010 4:21 AM
>> > *To:* Ron Piggott <[email protected]>
>> > *Cc:* [email protected] ; [email protected]
>> > *Subject:* Re: [PHP] Fw: Spoofing user_agent
>> >
>> > A standard HTTP Request headers is : User Agent (without the underscore).
>> >
>> > --Shreyas
>> >
>> > On Thu, Nov 25, 2010 at 2:36 PM, Ron Piggott <
>> > [email protected]> wrote:
>> >
>> >>
>> >> Is this what you are telling me to do:
>> >>
>> >> header('user_agent: RonBot (http://www.theverseoftheday.info)');
>> >>
>> >> Ron
>> >>
>> >> The Verse of the Day
>> >> “Encouragement from God’s Word”
>> >> http://www.TheVerseOfTheDay.info
>> >>
>> >> From: [email protected]
>> >> Sent: Thursday, November 25, 2010 3:34 AM
>> >> To: Ron Piggott ; [email protected]
>> >> Subject: Re: [PHP] Fw: Spoofing user_agent
>> >>
>> >> You need to set it in the header request you make. Putting it in the
>> >> script you're using as a spider with ini_set won't do anything because
>> the
>> >> Target site doesn't know anything about it.
>> >>
>> >> Thanks,
>> >> Ash
>> >> http://www.ashleysheridan.co.uk
>> >>
>> >> ----- Reply message -----
>> >> From: "Ron Piggott" <[email protected]>
>> >> Date: Thu, Nov 25, 2010 08:25
>> >> Subject: [PHP] Fw: Spoofing user_agent
>> >> To: <[email protected]>
>> >>
>> >> I have wrote a script to generate a sitemap of my web site. It crawls
>> all
>> >> of the site web pages. (About 30,000)
>> >>
>> >> I need help to spoof the user_agent variable so the stats program
>> running
>> >> in the background ( “AWSTATS” ) will treat the crawl as a bot, not
>> browsing
>> >> usage.
>> >>
>> >> The sitemap generator is a cron job. I tried the syntax:
>> >> ini_set('user_agent', 'RonBot (http://www.theverseoftheday.info)/'/);
>> >>
>> >> This didn’t work. The browsing was attributed to the dedicated IP
>> >> address.
>> >>
>> >> How do I get AWSTATS to access this, such as other entries under the
>> >> “Robots/Spiders visitors” heading:
>> >> Unknown robot (identified by 'bot*')
>> >>
>> >> I don’t mean any ill will by changing this setting. Thanks for the
>> help.
>> >>
>> >> Ron
>> >>
>> >> The Verse of the Day
>> >> “Encouragement from God’s Word”
>> >> http://www.TheVerseOfTheDay.info
>> >>
>> >>
>> >
>> >
>> > --
>> > Regards,
>> > Shreyas Agasthya
>> >
>>
>>
>>
>> --
>> Regards,
>> Shreyas Agasthya
>>
>
>
>
> --
> :DJ
>
It is no use using header(). This sets a header for the client, not
the server of any file_get_contents() requests.
I use stream_contexts.
$s_Contents = file_get_contents(
$s_URL,
False,
stream_context_create(
array(
'http' => array(
'method' => 'GET',
'header' => "User-Agent: RonBot (http://www.example.com)\r\n"
),
)
)
);
You can supply cookies, or anything else, with the request. Make sure
you add a \r\n to each of the headers and just concatenate them.
If you are doing this in a loop, then I'd recommend creating a default
stream context and then the request would just be ...
$s_Contents = file_get_contents($s_URL);
As the default stream context would be applied.
I had to use a default stream context to route all http requests
through an NTLM authentication proxy server because PHP doesn't deal
with NTLM authentication.
See my user notes on
http://docs.php.net/manual/en/function.stream-context-get-default.php.
Don't bother with the link at the bottom of the user note- it's not
live.
Richard.
--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
--- End Message ---
--- Begin Message ---
Is "User Agent" suppose to have a hyphen "-" ? Ron
The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info
-----Original Message-----
From: Richard Quadling
Sent: Thursday, November 25, 2010 9:16 AM
To: Deva
Cc: Shreyas Agasthya ; Ron Piggott ; [email protected] ;
[email protected]
Subject: Re: [PHP] Fw: Spoofing user_agent
On 25 November 2010 11:32, Deva <[email protected]> wrote:
Use curl
http://php.net/manual/en/book.curl.php
On Thu, Nov 25, 2010 at 4:41 PM, Shreyas Agasthya
<[email protected]>wrote:
I feel you should use more of the 4th method here as you are not trying
to
read the file but the header level (7th layer) information of the HTTP
protocol.
http://php.net/manual/en/function.file-get-contents.php
--Shreyas
On Thu, Nov 25, 2010 at 4:11 PM, Ron Piggott <
[email protected]
> wrote:
> Will the header pass with using file_get_contents , or should I be
using
> another command, and if so, which one? Ron
>
> <?php
>
> header('User Agent: RonBot (http://www.example.com)');
> $url = "http://www.example.com"; <http://www.example.com%22;>
>
> $input = file_get_contents($url);
>
>
>
> The Verse of the Day
> “Encouragement from God’s Word”
> http://www.TheVerseOfTheDay.info
>
> *From:* Shreyas Agasthya <[email protected]>
> *Sent:* Thursday, November 25, 2010 4:21 AM
> *To:* Ron Piggott <[email protected]>
> *Cc:* [email protected] ; [email protected]
> *Subject:* Re: [PHP] Fw: Spoofing user_agent
>
> A standard HTTP Request headers is : User Agent (without the
> underscore).
>
> --Shreyas
>
> On Thu, Nov 25, 2010 at 2:36 PM, Ron Piggott <
> [email protected]> wrote:
>
>>
>> Is this what you are telling me to do:
>>
>> header('user_agent: RonBot (http://www.theverseoftheday.info)');
>>
>> Ron
>>
>> The Verse of the Day
>> “Encouragement from God’s Word”
>> http://www.TheVerseOfTheDay.info
>>
>> From: [email protected]
>> Sent: Thursday, November 25, 2010 3:34 AM
>> To: Ron Piggott ; [email protected]
>> Subject: Re: [PHP] Fw: Spoofing user_agent
>>
>> You need to set it in the header request you make. Putting it in the
>> script you're using as a spider with ini_set won't do anything because
the
>> Target site doesn't know anything about it.
>>
>> Thanks,
>> Ash
>> http://www.ashleysheridan.co.uk
>>
>> ----- Reply message -----
>> From: "Ron Piggott" <[email protected]>
>> Date: Thu, Nov 25, 2010 08:25
>> Subject: [PHP] Fw: Spoofing user_agent
>> To: <[email protected]>
>>
>> I have wrote a script to generate a sitemap of my web site. It crawls
all
>> of the site web pages. (About 30,000)
>>
>> I need help to spoof the user_agent variable so the stats program
running
>> in the background ( “AWSTATS” ) will treat the crawl as a bot, not
browsing
>> usage.
>>
>> The sitemap generator is a cron job. I tried the syntax:
>> ini_set('user_agent', 'RonBot (http://www.theverseoftheday.info)/'/);
>>
>> This didn’t work. The browsing was attributed to the dedicated IP
>> address.
>>
>> How do I get AWSTATS to access this, such as other entries under the
>> “Robots/Spiders visitors” heading:
>> Unknown robot (identified by 'bot*')
>>
>> I don’t mean any ill will by changing this setting. Thanks for the
help.
>>
>> Ron
>>
>> The Verse of the Day
>> “Encouragement from God’s Word”
>> http://www.TheVerseOfTheDay.info
>>
>>
>
>
> --
> Regards,
> Shreyas Agasthya
>
--
Regards,
Shreyas Agasthya
--
:DJ
It is no use using header(). This sets a header for the client, not
the server of any file_get_contents() requests.
I use stream_contexts.
$s_Contents = file_get_contents(
$s_URL,
False,
stream_context_create(
array(
'http' => array(
'method' => 'GET',
'header' => "User-Agent: RonBot (http://www.example.com)\r\n"
),
)
)
);
You can supply cookies, or anything else, with the request. Make sure
you add a \r\n to each of the headers and just concatenate them.
If you are doing this in a loop, then I'd recommend creating a default
stream context and then the request would just be ...
$s_Contents = file_get_contents($s_URL);
As the default stream context would be applied.
I had to use a default stream context to route all http requests
through an NTLM authentication proxy server because PHP doesn't deal
with NTLM authentication.
See my user notes on
http://docs.php.net/manual/en/function.stream-context-get-default.php.
Don't bother with the link at the bottom of the user note- it's not
live.
Richard.
--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
--- End Message ---
--- Begin Message ---
On 24 November 2010 19:13, Ron Piggott <[email protected]> wrote:
>
> I am using this syntax to check for a valid e-mail address
>
> list($userName, $mailDomain) = split("@", $buyer_email);
> if (checkdnsrr($mailDomain, "MX")) {
>
> if no domain is provided ( ie e-mail address is something like “ron” with no
> @ ) the following error is displayed:
>
> Warning: checkdnsrr() [function.checkdnsrr]: Host and type cannot be empty
>
> Can I suppress this from displaying so *just* my error message displays?
>
> Ron
>
> The Verse of the Day
> “Encouragement from God’s Word”
> http://www.TheVerseOfTheDay.info
I would first check to see if there is an @ in $buyer_email.
if (False !== strpos($buyer_email, '@')) {
// Your code goes here.
}
If you turn on notices, you'll see you are getting ...
Notice: Undefined offset: 1 in ...
So, you are actually generating 2 errors by not checking for the @ first.
--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
--- End Message ---
--- Begin Message ---
Have you done some perfs testing ?
Gunning sky
Le 23 nov. 2010 00:34, "Andre Polykanine" <[email protected]> a écrit :
> Hello Yermo,
>
> thanks a lot! I will try this on my project (http://oire.org/) and
> I'll inform you if I modify it somehow.
> --
> With best regards from Ukraine,
> Andre
> Skype: Francophile
> Twitter: http://twitter.com/m_elensule
> Facebook: http://facebook.com/menelion
>
> ----- Original message -----
> From: Yermo <[email protected]>
> To: [email protected] <[email protected]>
> Date: Tuesday, November 23, 2010, 1:04:19 AM
> Subject: [PHP] rewriteTextLinks.php - make URLs in plain text clickable
>
> I'm posting this in the hopes that it will be of some use to someone.
>
> I've put together a little regex function for finding and transforming
> links in blocks of plain text into clickable links while applying some
> heuristics to handle the more common edge cases.
>
> Unlike so many solutions I've found online this one handles more edge
> cases including periods and commas at the end, surrounding parentheses,
> trailing periods on only the domain part, etc. etc.
>
>
http://formvista.com/fv-b-12-170/rewriteTextLinks-----a-function-to-make-links-in-blocks-of-text--quot-clickable-quot-.html
>
> ---------------------------------------------------------------
> Yermo Lamers DTLink, LLC
> Software Developer http://www.dtlink.com
>
> http://miles-by-motorcycle.com For Motorcycle Travellers
> http://formvista.com Entrepreneurs CMS and Business Platform
> ---------------------------------------------------------------
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
On 25 November 2010 00:14, Tommy Pham <[email protected]> wrote:
>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]] On Behalf Of
>> Daniel P. Brown
>> Sent: Monday, November 22, 2010 12:08 PM
>> To: Dee Ayy
>> Cc: PHP General
>> Subject: Re: [PHP] Can't find existing file
>>
> <snip>
>> so how are we to know?); (h) some other PEBKAC issue;
> <snip>
>
> It's been almost a decade since I've seen 'PEBKAC' used :)
I prefer PICNIC.
So you can now have a Senior Picnic or a Kiddies Picnic and it all
sounds quite pleasant.
--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
--- End Message ---
--- Begin Message ---
On Thu, Nov 25, 2010 at 9:07 AM, Richard Quadling <[email protected]> wrote:
> On 25 November 2010 00:14, Tommy Pham <[email protected]> wrote:
>>> -----Original Message-----
>>> From: [email protected] [mailto:[email protected]] On Behalf Of
>>> Daniel P. Brown
>>> Sent: Monday, November 22, 2010 12:08 PM
>>> To: Dee Ayy
>>> Cc: PHP General
>>> Subject: Re: [PHP] Can't find existing file
>>>
>> <snip>
>>> so how are we to know?); (h) some other PEBKAC issue;
>> <snip>
>>
>> It's been almost a decade since I've seen 'PEBKAC' used :)
>
> I prefer PICNIC.
>
> So you can now have a Senior Picnic or a Kiddies Picnic and it all
> sounds quite pleasant.
>
> --
> Richard Quadling
> Twitter : EE : Zend
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
i like that. PICNIC
--
Bastien
Cat, the other other white meat
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Bastien Koert [mailto:[email protected]]
> Sent: Thursday, November 25, 2010 7:42 AM
> To: [email protected]
> Cc: Tommy Pham; Daniel P. Brown; Dee Ayy; PHP General
> Subject: Re: [PHP] Can't find existing file
>
> On Thu, Nov 25, 2010 at 9:07 AM, Richard Quadling <[email protected]>
> wrote:
> > On 25 November 2010 00:14, Tommy Pham <[email protected]>
> wrote:
> >>> -----Original Message-----
> >>> From: [email protected] [mailto:[email protected]] On Behalf Of
> >>> Daniel P. Brown
> >>> Sent: Monday, November 22, 2010 12:08 PM
> >>> To: Dee Ayy
> >>> Cc: PHP General
> >>> Subject: Re: [PHP] Can't find existing file
> >>>
> >> <snip>
> >>> so how are we to know?); (h) some other PEBKAC issue;
> >> <snip>
> >>
> >> It's been almost a decade since I've seen 'PEBKAC' used :)
> >
> > I prefer PICNIC.
> >
> > So you can now have a Senior Picnic or a Kiddies Picnic and it all
> > sounds quite pleasant.
> >
> > --
> > Richard Quadling
> > Twitter : EE : Zend
> > @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
> >
> > --
> > PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
> > http://www.php.net/unsub.php
> >
> >
>
>
> i like that. PICNIC
> --
>
> Bastien
>
> Cat, the other other white meat
That does sound a lot better :)
Regards,
Tommy
--- End Message ---
--- Begin Message ---
On Nov 25, 2010, at 8:07 AM, Richard Quadling wrote:
I prefer PICNIC.
So you can now have a Senior Picnic or a Kiddies Picnic and it all
sounds quite pleasant.
Ok, I give, what's a PICNIC?
--- End Message ---