Jump to content

inserting code into echo


pioneerx01

Recommended Posts

I have this code running

 

if (some equality statement)
{echo "Error code";}
else {echo "success code";}

 

If I run this code alone everything works as expected. Thus if there is an equality in my statement user gets error code and if not they get success code. Now I want this code (one below) to run only in success code of the statement

 

$url = 'http://www.mysite/../mypage.php?';
$url .= 'email='.urlencode($_POST['email']);

$result = getPage('', $url, '', 15);

function getPage($proxy, $url, $header, $timeout) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, $header);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_PROXY, $proxy);
    curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    curl_setopt($ch, CURLOPT_REFERER, 'http://othersite.org');
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0. Gecko/2009032609 Firefox/3.0.8');
    $result['EXE'] = curl_exec($ch);
    $result['INF'] = curl_getinfo($ch);
    $result['ERR'] = curl_error($ch);
    curl_close($ch);
    return $result;
}

 

But I am constantly getting errors. I have tried to modify the code as best I can, but no success. So, that is the original code that works alone just fine, but not withing my "success code."

 

Any ideas, Thanks...

Link to comment
https://forums.phpfreaks.com/topic/222346-inserting-code-into-echo/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.