title: WSOD on PHP script
body: <p>Every time I run the code below, I get a WSOD. Not sure what I'm doing wrong with this code.  Nothing gets logged and I've verified my php.ini configurations are well set to display all errors. Any help on this would be appreciated.</p>
  
  <p>
  
  <pre><code> // MAIN BIDDING FUNCTION MAIN BIDDING FUNCTION
   // this function performs no checking on the input variables
    $username  =  '1*****';
    $password  =  '******';
    $item      =  '*******';
    $bid       =  '***.**';
   // $link      -  itemlink with referral, can leave empty i.e. ''
   function place_bid($username, $password, $item, $bid, $link) {
  
       $cookies = dirname(__FILE__).'/cookies.txt';
  
       //set success as default false
       $success = false;
       $bid_success = false;
  
       $curl = curl_init();
       curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
       curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)');
       curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
       curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
       curl_setopt($curl, CURLOPT_REFERER, $link);
       curl_setopt($curl, CURLOPT_COOKIEFILE, $cookies);
       curl_setopt($curl, CURLOPT_COOKIEJAR, $cookies);
  
       //query the sign-out page
       //curl_setopt($curl, CURLOPT_URL, "https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&amp;lgout=1");
       //$ret = curl_exec ($curl);
  
       //query the referal link page
       if ($link) {
           curl_setopt($curl, CURLOPT_URL, $link);
           $ret = curl_exec ($curl);
       }
  
       //IMPORTANT     
       //query the sign-in page to set the cookies
       curl_setopt($curl, CURLOPT_URL, 'https://signin.ebay.com/aw-cgi/eBayISAPI.dll?SignIn&amp;campid=5337161990&amp;customid=7');
       $ret = curl_exec ($curl);
  
       $data = [];
       $numbers = [];
       if (preg_match('%(&lt;form name="SignInForm".*?&lt;\/form)%im', $ret, $regs)) {
  
           $dom = new DOMDocument;
           $dom-loadHTML($regs[0]);
           $nodes = $dom-getElementsByTagName('input');
  
           foreach($nodes as $node) {
               $name  = $node-getAttribute('name');
               $value = $node-getAttribute('value');
               //$size  = $node-getAttribute('size');
               $type  = $node-getAttribute('type');
  
               $data[$name] = $value;
  
               if (is_numeric($name)) {
                   if ($type == 'text') {
                       $data[$name] = $username;
                   }
                   if ($type == 'password') {
                       $data[$name] = $password;
                   }
               }
           }
       }
  
       unset($data['']);
       $data_str = http_build_query($data);
  
       //sign-in
       curl_setopt($curl, CURLOPT_URL, "https://signin.ebay.com/ws/eBayISAPI.dll?co_partnerId=2&amp;siteid=0&amp;UsingSSL=1");
       curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
       curl_setopt($curl, CURLOPT_POSTFIELDS, $data_str);
       $ret = curl_exec ($curl);
  
       if(curl_errno($curl)){
           ebaylog('Curl error: ' . curl_error($curl));
       }
       if (!$ret) {
           $ret = curl_exec ($curl);
           if(curl_errno($curl)){
               ebaylog('Curl error: ' . curl_error($curl));
           }
           if (!$ret) {
               $ret = curl_exec ($curl);
               if(curl_errno($curl)){
                   ebaylog('Curl error: ' . curl_error($curl));
               }
           }
       }
  
       curl_setopt($curl, CURLOPT_URL, 'https://www.ebay.com/myb/WatchList');
       $ret = curl_exec ($curl);
  
       //test_write($ret);
  
       if(curl_errno($curl)){
           ebaylog('Curl error: ' . curl_error($curl));
       }
       if (!$ret) {
           $ret = curl_exec ($curl);
           if(curl_errno($curl)){
               ebaylog('Curl error: ' . curl_error($curl));
           }
           if (!$ret) {
               $ret = curl_exec ($curl);
               if(curl_errno($curl)){
                   ebaylog('Curl error: ' . curl_error($curl));
               }
           }
       }
  
  
  
       //if (strpos($ret, '"loggedIn":true') === FALSE) {
       if ((strpos($ret, "userid={$username}") === FALSE) &amp;&amp; (strpos($ret, "usr/{$username}") === FALSE)) {
           if (preg_match('%&lt;b class="altTitle"(.*)&lt;/b%', $ret, $regs)) {
               $err = $regs[1];
               ebaylog("\"{$err}\"");
               if (strpos($err, 'The alerts below') === 0) {
                   ebaylog("{$item}: 'The alerts below' found, successful");
                   //set it to succes
               }
           } else {
               ebaylog("{$item}: Failed signing in");
               if (preg_match('%&lt;font face=".*?" size="3"&lt;b(.*?)&lt;/b&lt;/font%', $ret, $regs)) {
                   $err = $regs[1];
                   ebaylog("\"{$err}\"");
               }
  
               //test_write($ret);
               goto end;
           }
  
  
       } else {
           ebaylog("{$item}: Success signing in");
       }
  
  
       //place the inital bid
       curl_setopt($curl, CURLOPT_URL, "https://offer.ebay.com/ws/eBayISAPI.dll?MakeBid&amp;item={$item}&amp;maxbid={$bid}&amp;campid=5337161990&amp;customid=7");
       $ret = curl_exec ($curl);
       if(curl_errno($curl)){
           ebaylog('Curl error: ' . curl_error($curl));
       }
       if (!$ret) {
           $ret = curl_exec ($curl);
       }
  
       if (preg_match_all('/(?:value="([-0-9a-zA-Z]*)" *)?name="stok"(?: *value="([-0-9a-zA-Z]*)")?/', $ret, $regs)) {
           $stok = $regs[1][0];
       } else {
           //Failed to get 'stok' value
           //try and determine why
           if (preg_match('%&lt;div class="statusDiv"(.*?)&lt;/div%', $ret, $regs)) {
               $err = $regs[1];
               ebaylog("'{$err}'");
               //if string starts with "Enter US $0.41 or more"
               if (stripos($err, 'Enter') === 0) {
                   ebaylog("{$item}: 'Enter' found, aborting");
                   //set it to success
                   $success = true;
               } else if (stripos($err, 'To enter a') === 0) {
                   ebaylog("{$item}: 'To enter a' found, aborting");
                   //set it to success
                   $success = true;
               } else if (stripos($err, 'Transaction Blocked') === 0) {
                   ebaylog("{$item}: 'Transaction Blocked' found, aborting");
                   //set it to success
                   $success = true;
               }
  
           } else if (preg_match('%"\d*" - Invalid Item&lt;/div%', $subject)) {
               ebaylog("{$item}: 'Invalid Item' found, aborting");
               test_write($ret);
               //set it to success
               $success = true;
           } else if (preg_match('%&lt;div class="subTlt"&lt;ul class="errList"&lt;li(.*?)&lt;/li&lt;/ul&lt;/div%', $subject)) {
               ebaylog("{$item}: 'no longer available' found, aborting");
               test_write($ret);
               //set it to success
               $success = true;
           } else if (preg_match('%id="w\d-\d-_msg".*?(.*?)&lt;/span%', $ret, $regs)) {
               ebaylog("'{$regs[1]}'");
           } else if (preg_match('%&lt;div\s+class\s*=\s*"(?:errRed|errBlk|errTitle|statusDiv)"\s*(.*?)&lt;/div%i', $ret, $regs)) {
               ebaylog("'{$regs[1]}'");
           } else {
               //don't know why so log the page
               ebaylog("{$item}: Failed to get 'stok' value");
               test_write($ret);
           }
           goto end;
       }
  
       if (preg_match_all('/(?:value="([-0-9a-zA-Z]*)" *)?name="uiid"(?: *value="([-0-9a-zA-Z]*)")?/', $ret, $regs)) {
           $uiid = $regs[1][0];
       } else {
           ebaylog("{$item}: Failed to get 'uiid' value");
           goto end;
       }
  
  
       if ($stok &amp;&amp; $uiid) {
           ebaylog("{$item}: Success placing initial bid");
       } else {
           ebaylog("{$item}: Failed placing initial bid");
           goto end;
  
       }
  
       //confirm the bid
       curl_setopt($curl, CURLOPT_URL, "https://offer.ebay.com/ws/eBayISAPI.dll?MfcISAPICommand=MakeBid&amp;maxbid={$bid}&amp;quant=1&amp;mode=1&amp;stok={$stok}&amp;uiid={$uiid}&amp;co_partnerid=2&amp;user={$username}&amp;fb=0&amp;item={$item}&amp;campid=5337161990&amp;customid=7");
       $ret = curl_exec ($curl);
       if(curl_errno($curl)){
           ebaylog('Curl error: ' . curl_error($curl));
       }
       if (!$ret) {
           $ret = curl_exec ($curl);
       }
  
       //perform a number of tests to determine if the bid was a success
       $bid_success = true;
       if (stripos($ret, "you're the first bidder") === FALSE) {
           if (stripos($ret, "you're the high bidder and currently in the lead") === FALSE) {
               if (stripos($ret, "you're currently the highest bidder") === FALSE) {
                   $bid_success  = false;
                   ebaylog("{$item}: Failed placing final bid");
                   //try and determine why
                   if (preg_match('%&lt;div\s+class\s*=\s* (?:errRed|errBlk|errTitle|statusDiv|title)"\s*(.*?)&lt;/div%i', $ret, $regs)) {
                       $err = $regs[1];
                       ebaylog("'{$err}'");
                       if (stripos($err, 'Enter') === 0) {
                           ebaylog("{$item}: 'Enter' found, aborting");
                           //set it to success
                           $bid_success = true;
                       } else if (stripos($err, "You've just been outbid") === 0) {
                           ebaylog("{$item}: 'You've just been outbid' found, aborting");
                           //set it to success
                           $bid_success  = true;
                       } else if (stripos($err, "You're currently the high bidder,") === 0) {
                           ebaylog("{$item}: 'You're currently the high bidder, but the reserve hasn't been met.' found, aborting");
                           //set it to success
                           $bid_success  = true;
                       }
                   } else {
                       //we don't know why it failed so write the data
                       test_write($ret);
                   }
               }
           }
       }
  
       if ($bid_success) {
           ebaylog("{$item}: Success placing final bid");
           $success = true;
       }
  
       end:
  
       //close the curl session
       curl_close ($curl);
  
       if ($success) {
           ebaylog("{$item}: Success: {$username}");
       } else {
           ebaylog("{$item}: Failure: {$username}");
       }
  
       return $success;
   }
  
  
   ?
  </code></pre>