cron jobs doesn't work with some php function
<p>when i set some cron jobs for loading a php file cron doesn't work and it seams some php function have problem with cron job.
i know my cron command is true because i tested my cron job working true with simple php code that put date to a text file so my cron command is true i tested all ways of command like : wget, crul , cd, php , /user/local/bin/php and another but i don't know why my php code doesn't work and too i test that codes working very well when i loading php files with my browser.</p>

<p>my php file code:</p>

<pre><code>&lt;?php
header('Content-Type: text/html; charset=utf-8');
include ('simple_html_dom.php');
$mycache_url = 'http://example3.com';
$mybziran_url = 'http://example2.com';

function addhttp($url)
{
    if (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
        global $mybziran_url;
        $url = ltrim($url, '/');
        $url = $mybziran_url . '/' . $url;
    }
    return $url;
}
function urlencodeproblem($badurl)
{
    $badurl = urlencode($badurl);
    $badchar = array('%3A', '%2F');
    $truechar = array(':', '/');
    $badurl = str_replace($badchar, $truechar, $badurl);
    return $badurl;
}

$url_html = @file_get_html($mycache_url);

$bziran_url = '';
$bziran_title = '';
foreach (@$url_html-&gt;find('a') as $elements) {
    $bziran_url[] = urlencodeproblem($elements-&gt;href);
    $bziran_title[] = $elements-&gt;innertext;
}
$myi = count($bziran_url);
for ($i = 0; $i &lt; $myi; ++$i) {
    $post_title = $bziran_title[$i];
    $post_url = $bziran_url[$i];

    $html = @file_get_html($post_url);

    foreach ($html-&gt;find('div.price') as $myhtml_price_adelete) {
        echo '######' . $myhtml_price_adelete-&gt;innertext . '######';
    }

    $bad_title_my = '';
    foreach ($html-&gt;find('h1 a') as $myhtml_price_adelete) {
        $bad_title_my .= $myhtml_price_adelete-&gt;innertext;
    }
    if (empty($bad_title_my)) {
        echo $post_url;
        echo 'prob';
    } else {
        $kalame = urlencode($post_title);
        $A2_html = 'ok';

        foreach ($html-&gt;find('a') as $myhtml_a_code) {
            $e_ahref = addhttp($myhtml_a_code-&gt;href);
            $myhtml_a_code-&gt;href = $e_ahref;
            $myhtml_a_code-&gt;target = '_blank';
        }
        $html-&gt;save();
        foreach ($html-&gt;find('img') as $myhtml_img_code) {
            if (strpos($myhtml_img_code-&gt;src, 'base64') === false) {
                $e_imgsrc = addhttp($myhtml_img_code-&gt;src);
                $myhtml_img_code-&gt;src = $e_imgsrc;
            }
        }
        $html-&gt;save();

        $mymeta_keyword = '';
        foreach ($html-&gt;find('meta[name=keywords]') as $myhtml_keyword) {
            $mymeta_keyword[] = $myhtml_keyword-&gt;content;
        }

        foreach ($html-&gt;find('p') as $mytagdelete) {
            if (strpos($mytagdelete-&gt;innertext, 'tag :') !== false) {
                $mytagdelete-&gt;outertext = '';
            }
        }
        $html-&gt;save();

        foreach ($html-&gt;find('h1 a') as $myadelete) {
            $myadelete-&gt;outertext = $myadelete-&gt;innertext;
        }
        $html-&gt;save();

        $a3_href = '';
        $a2_href = $html-&gt;find("img[alt=buy]");
        foreach ($a2_href as $a2_href) {
            $a2_href-&gt;outertext =
                '&lt;br&gt;&lt;p align="center"&gt;&lt;img alt="pay-download" src="http://exam.com/tmp_files/01-pay-download.png"&gt;&lt;/p&gt;';
        }
        $html-&gt;save();
        echo '&lt;br&gt;buy : ' . $a3_href . '&lt;br&gt;';

        $myhtmlcode3 = '';
        foreach ($html-&gt;find('div.prod') as $myhtmlcode) {
            $myhtmlcode3 .= $myhtmlcode-&gt;outertext;
        }
        $html-&gt;save();

        echo '&lt;br&gt;*** title ***' . $post_title . '&lt;br&gt;';
        echo $post_url . '&lt;br&gt;';

        $i_t = mt_rand(1, 34);
        $mysaier_mahsolat = '&lt;br&gt;
&lt;a target="_blank" href="http://ayta.ir/index.php?page=' . $i_t . '"&gt; click &lt;/a&gt;
&lt;br&gt;';

        echo $mysaier_mahsolat;

        echo $A2_html . $myhtmlcode3 . '&lt;br&gt;';

        echo 'keyword :' . $mymeta_keyword[0];
    }

}
?&gt;
&lt;?
$crontest = date("Y-m-d - h:i:s") . "\n" . file_get_contents(dirname(__file__) .
    DIRECTORY_SEPARATOR . "cron.txt");
echo $crontest;
file_put_contents("cron.txt", $crontest);
?&gt;
</code></pre>