Included with this script is a feature which checks if the links are active or not with the use of fopen().
My problem is that as the links are extracted from the text, using the explode() function, separated by semi-colons, whitespace is left at the front of each resultant string, meaning that fopen() always fails due to the leading whitespace.
I have tried trim()ing and ltrim()ing each URL string, however it fails at stripping any leading whitespace.
I made another example to check my ltrim() useage, and still it doesn't want to strip the unwanted whitespace.
Code: Select all
<?php
if(!empty($_POST[text])) {
trim($_POST[text]);
echo '"'."$_POST[text]".'"';
}
?>The PHP manual says that without using the 2nd paramater for the ltrim() function, it strips whitespace, new rows, tabs and all... however I just can't get it to work?
If anyone could shed any light on this problem I would be really grateful...