Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.