How to tell if Mime type matches contents

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ed Eichman

    How to tell if Mime type matches contents

    Hi Everyone,

    Before I write the script myself, I'm looking for PHP code that checks
    that a link's content type matches it's contents. I need this for my
    "broken link" checker script, which fails to spot the "broken" links
    http://www.awin1.com/show.php?mid=10...6515&aid=49007 and
    http://www.awin1.com/awclick.php?mid...36515&id=49007. Any
    ideas?

    BTW, in case the links get fixed before you read the message, the first
    link is a GIF MIME that returns

    [document.write( '<a
    href="http://www.affiliatewi ndow.com/?id=.&banner=no "
    target="_blank" ><img
    src="http://www.awin1.com/show.php?mid=3& gid=14&aid=477& clickref=nobann er"
    border="0"></a>')]

    which displays as

    [The image
    "http://www.awin1.com/show.php?mid=10 14&linkid=36515 &aid=49007"
    cannot be displayed, because it contains errors.] .

    The second is a text/html that returns

    [<br />
    <b>Warning</b>: mysql_result(): Unable to jump to row 0 on MySQL
    result index 30 in <b>/home/sites/site3/web/awclick.php</b> on line
    <b>51</b><br /> <br />
    <b>Warning</b>: mysql_fetch_arr ay(): supplied argument is not a valid
    MySQL result resource in
    <b>/home/sites/site3/web/linkdeliveryfun ctions.inc.php</b> on line
    <b>178</b><br /> <br />

    <b>Warning</b>: mysql_result(): supplied argument is not a valid MySQL
    result resource in
    <b>/home/sites/site3/web/linkdeliveryfun ctions.inc.php</b> on line
    <b>478</b><br /> <br />
    <b>Warning</b>: Cannot modify header information - headers already
    sent by (output started at /home/sites/site3/web/awclick.php:51) in
    <b>/home/sites/site3/web/linkdeliveryfun ctions.inc.php</b> on line
    <b>462</b><br /> <br />
    <b>Warning</b>: Cannot modify header information - headers already
    sent by (output started at /home/sites/site3/web/awclick.php:51) in
    <b>/home/sites/site3/web/awclick.php</b> on line <b>235</b><br /> ]

    Thanks,
    Ed

Working...