pioneerx01 Posted December 22, 2010 Share Posted December 22, 2010 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... Quote Link to comment https://forums.phpfreaks.com/topic/222346-inserting-code-into-echo/ Share on other sites More sharing options...
denno020 Posted December 22, 2010 Share Posted December 22, 2010 What are the errors you are getting? Which lines do they appear on? Can you show the code inside the if/else statement code blocks too.. Denno Quote Link to comment https://forums.phpfreaks.com/topic/222346-inserting-code-into-echo/#findComment-1150143 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.