Welcome to Questionaries, where you can ask questions and receive answers from other members of the community.

Let us know at info@questionaries.org

PHP help, please

6 like 0 dislike
I have developed a broken link checker that works great, unless the URLs don't have the base href in them.
For example:
If the links are ...href="http://www.somesite.com/somepage.html"... is works great
But if they are ...href="somepage.html"..., ...href="/somepage.html"..., or...href="./somepage.html"... it ignors them

Here's the problem code:
===========================================
 $matches = array();
  preg_match_all("|href\=\"?'?`?([[:alnum:]:?=&@/;._-]+)\"?'?`?|i",  $html, $matches);
  $links = array();
  $ret = $matches[1];
  for($i=0;isset($ret[$i]);$i++) {
     if(preg_match("|^http://(.*)|i", $ret[ $i])) {
         $links[] = $ret[$i];
     } elseif(preg_match("|^(.*)|i", $ret[$i])) {
         $links[] = "http://".$info["host"]."". $ret[$i];
     }
  }
  return $links;
}
==============================================
I thought
} elseif(preg_match("|^(.*)|i", $ret[$i])) {
$links[] = "http://".$info["host"]."". $ret[$i];
would have taken care if it. Please help!
Many Thanks.
__________________
asked 2 years ago by eagle09 (95,490 points)

1 Answer

0 like 0 dislike
The google documentation says that ports 465 or 587 should be used for connections to the SMTP server. It seems that Mail_smtp uses 25 by default. Try an explicit value of 465 or 587 with the 'port' parameter

$smtp = Mail::factory(
    'smtp',
    array('host' => $host,
          'port' => 465,     // explicit port 465 or 587
          'auth' => true,
          'username' => $username,
          'password' => $password),
);
answered 2 years ago by biswaskeran (70,430 points)

Related questions

10 like 0 dislike
0 answers
7 like 0 dislike
1 answer
asked 2 years ago by eagle09 (95,490 points)
7 like 0 dislike
0 answers
asked 2 years ago by eagle09 (95,490 points)
7 like 0 dislike
3 answers
8 like 0 dislike
1 answer