php-general Digest 25 Nov 2010 07:26:15 -0000 Issue 7053

Topics (messages 309651 through 309657):

Re: Suppressing error from displaying
        309651 by: Thiago H. Pojda
        309652 by: Daniel P. Brown
        309653 by: Bastien Koert

Re: curl and variable parameters in hyperlink
        309654 by: Bob Keightley
        309656 by: Tommy Pham
        309657 by: Bob Keightley

Re: Can't find existing file
        309655 by: Tommy Pham

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 Wed, Nov 24, 2010 at 5:13 PM, 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
>

Just add @ before checkdnsrr:

list($userName, $mailDomain) = split("@", $buyer_email);
if (@checkdnsrr($mailDomain, "MX")) {


But you shouldn't use @ as it will make a PITA to find errors in your code
when maintaining it. You should not display Warnings on production too, at
least not for users but instead log those.


Cheers,
Thiago Pojda

--- End Message ---
--- Begin Message ---
On Wed, Nov 24, 2010 at 14: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?

    Sure.

    if (@checkdnsrr($mailDomain,'MX'))

-- 
</Daniel P. Brown>
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

--- End Message ---
--- Begin Message ---
On Wed, Nov 24, 2010 at 2:13 PM, 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

if ( @checkdnsrr($mailDomain, "MX") ) {

might work.. the @ symbol usually suppresses the error

-- 

Bastien

Cat, the other other white meat

--- End Message ---
--- Begin Message ---
Guess I've not explained this very well.

The external page I am fetching using another curl script has asp query 
hyperlinks in it. I do not know the variable names in each query or the 
values they have.

All I want to do is replace the external url referenced in those links with 
a url which is on my site (so that I can change style sheet, image locations 
etc.) but the parameters to the original asp query link have to be captured 
and passed to my php script for it to return data.  I know there must be a 
way of doing this as there's a site which is referencing the same third 
party site and doing the same thing, and no, they won't tell me how! 



--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Bob Keightley [mailto:[email protected]]
> Sent: Wednesday, November 24, 2010 11:25 AM
> To: [email protected]
> Subject: Re: [PHP] curl and variable parameters in hyperlink
> 
> Guess I've not explained this very well.
> 
> The external page I am fetching using another curl script has asp query
> hyperlinks in it. I do not know the variable names in each query or the
> values they have.
> 
> All I want to do is replace the external url referenced in those links
with a
> url which is on my site (so that I can change style sheet, image locations
> etc.) but the parameters to the original asp query link have to be
captured
> and passed to my php script for it to return data.  I know there must be a
> way of doing this as there's a site which is referencing the same third
party
> site and doing the same thing, and no, they won't tell me how!
> 

Bob,

There's several issues with this.

1) They're providing the info which you're trying to pass it as your own and
most likely that they won't get any positive results, as some company do
analysis on visits to improve the marketing strategy, customer service,
customer relations, etc.  You're just skewing their data analysis and
prevent them from becoming successful.  Which may force them to go out of
business then you'll lose your source of information.
2) Waste of bandwidth.  3rd party > you > user instead of just you > user.
3) I'm don't like that fact that some people take others work and try to
pass it as their own.  I think many folks on this list feels the same way.
So why not just quote them and give them the credit they deserve.  That's
probably the reason why you're not able to find much info on how to do this
:)

Regards,
Tommy


--- End Message ---
--- Begin Message ---
 Thanks to all for your interest so far but as I said, new to PHP. Changed
POST to GET and all now working fine!

 Tommy, the third party site is fully aware of what I am doing. We pay them
to use the data, as do lots of other companies in our industry. Supplying
data is what they do. We could not use the site at all without being given a
valid user name. Far from 'preventing them being successful' the more users
they have the more successful they become. We do not 'pass the work as our
own' they are credited on our site as suppliers of the content, so there
really is no issue there.


--- End Message ---
--- Begin Message ---
> -----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  :)

Regards,
Tommy


--- End Message ---

Reply via email to