title: Using cURL, (how) is it possible to execute a PHP command on a remote page and return it as a string variable?
body: <p>What I want to do using cURL:</p>
  
  <ol>
  <li><p>Login to my Wordpress site, execute my own PHP code and save it to a variable:</p>
  
  <p><b>$code_to_execute_remotely = wp_create_nonce('my_form');</b>  </p>
  
  <p>$ch = curl_init();<br>
  curl_setopt($ch, CURLOPT_URL, 'www.mywordpresssite.com');<br>
  <b>curl_setopt($ch, CURLOPT_SOMEMYSTERIOUSFUNCTION, $code_to_execute_remotely); 
  $resulting_variable = curl_exec($ch);</b></p></li>
  <li><p>Then use that variable in a 2nd cURL execution:</p>
  
  <p>curl_setopt($ch, CURLOPT_MYSECONDFUNCTION, <b>$resulting_variable</b>);<br>
  $second_ececution = curl_exec($ch);<br>
  curl_close($ch);</p></li>
  </ol>
  
  <p>I've used dummy code to simplify things of course. The other functionality (logging into the remote site, etc.) is no problem, just executing that code remotely and returning its results as a usable variable, that's all I need. Since I'm not terribly familiar w/ cURL, it's possible I'm attempting something beyond its bounds, in which case I'd be very thankful to know what alternative <i>could</i> achieve this.</p>