3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php ob_start(); $sfid = ''; $sa = ''; $lo = ''; $ra = ''; $numrec = ''; try { $arrayleadurimap= array( "1274235@accela.3ccloud.com" => "Charles Brown", "1274271@accela.3ccloud.com" => "Chad Devero", "1274243@accela.3ccloud.com" => "Chantz Gnad", "1274247@accela.3ccloud.com" => "Chad Lee", "1274275@accela.3ccloud.com" => "Chris Meyn", "1274251@accela.3ccloud.com" => "Jared Borberg", "1274279@accela.3ccloud.com" => "Josh Holloway", "1274283@accela.3ccloud.com" => "Karon McGlinn", "1274287@accela.3ccloud.com" => "Michaell Wallace-Beaven", "1274291@accela.3ccloud.com" => "Matt Fisher", "1274255@accela.3ccloud.com" => "Martin Wehrenberg", "1274295@accela.3ccloud.com" => "Pam Castrey", "1274259@accela.3ccloud.com" => "Terrence Abney", "1274299@accela.3ccloud.com" => "Terence Gunn", "1274263@accela.3ccloud.com" => "Trey Sparks", "12742107@accela.3ccloud.com" => "Caleb Foreman", "12742111@accela.3ccloud.com" => "Greg Weber", "12742115@accela.3ccloud.com" => "Chris Kneedler", "12742119@accela.3ccloud.com" => "Ryan Haynes", "12742123@accela.3ccloud.com" => "Beau Bryan", "12742127@accela.3ccloud.com" => "Nancy Sisson", ); $username = $_GET["username"]; $password = $_GET["password"]; $number = $_GET["number"]; $url="https://login.salesforce.com/services/Soap/c/28.0/0DFd0000000HB01"; $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>". "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:tns=\"urn:enterprise.soap.sforce.com\">". "<soap:Header>". "<tns:LoginScopeHeader>". "<tns:organizationId/>". "</tns:LoginScopeHeader>". "</soap:Header>". "<soap:Body>". "<tns:login>". "<tns:username>".$username."</tns:username>". "<tns:password>".$password."</tns:password>". "</tns:login>". "</soap:Body>". "</soap:Envelope>"; $headers = array( 'Content-Type:text/xml; charset=utf-8', 'User-Agent:Webastra', 'SOAPAction:login', ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLINFO_HEADER_OUT, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); $result = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); $oXML = new SimpleXMLElement($result); $oXML->registerXPathNamespace('c', 'http://schemas.xmlsoap.org/soap/envelope/'); $oXML->registerXPathNamespace('f', 'urn:enterprise.soap.sforce.com'); $metadata1 = $oXML->xpath('//f:serverUrl'); $metadata2 = $oXML->xpath('//f:sessionId'); $serverurl = $metadata1[0]; $sessionid = $metadata2[0]; $to = $number; $len = strlen($number); if($len >= 10) { $to = sprintf("(%s) %s-%s", substr($number, 0, 3), substr($number, 3, 3), substr($number, 6)); } //search sfid $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?> <soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:tns=\"urn:enterprise.soap.sforce.com\"> <soap:Header> <tns:SessionHeader> <tns:sessionId>".$sessionid."</tns:sessionId> </tns:SessionHeader> <tns:QueryOptions/> <tns:MruHeader> <tns:updateMru>true</tns:updateMru> </tns:MruHeader> <tns:PackageVersionHeader/> </soap:Header> <soap:Body> <tns:query> <tns:queryString>select Id,Stips_Agent__c,F9LO__c,F9Retention_Agent__c from Lead where Phone like '%".$to."%' OR Phone like '%".$number."%'</tns:queryString> </tns:query> </soap:Body> </soap:Envelope>"; $headers = array( 'Content-Type:text/xml; charset=utf-8', 'User-Agent:Webastra', 'SOAPAction:""', ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $serverurl); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLINFO_HEADER_OUT, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); $result = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); $oXML = new SimpleXMLElement($result); $oXML->registerXPathNamespace('c', 'http://schemas.xmlsoap.org/soap/envelope/'); $oXML->registerXPathNamespace('d', 'urn:enterprise.soap.sforce.com'); $oXML->registerXPathNamespace('f', 'urn:sobject.enterprise.soap.sforce.com'); $metadata1 = $oXML->xpath('//f:Id'); $metadata2 = $oXML->xpath('//f:Stips_Agent__c'); $metadata3 = $oXML->xpath('//f:F9LO__c'); $metadata4 = $oXML->xpath('//f:F9Retention_Agent__c'); $sfid = $metadata1[0]; $sa = $metadata2[0]; $lo = $metadata3[0]; $ra = $metadata4[0]; $leadfield = ''; $agenturi=''; if(strlen($sfid) > 0) { if(strlen($ra) != 0) { $leadfield = $ra; } else if(strlen($sa) != 0) { $leadfield = $sa; } else if(strlen($lo) != 0) { $leadfield = $lo; } } if(strlen($leadfield) != 0) { while ($val1 = current($arrayleadurimap)) { if ($val1==$leadfield) { $agenturi = key($arrayleadurimap); break; } next($arrayleadurimap); } } if(strlen($agenturi) != 0) { print 'call='.$agenturi.',sfid='.$sfid; } else { print 'prom=,result='.$result; } } catch(Exception $e) { echo $e; } ob_flush(); ?>
Output for 7.0.0 - 7.1.0
Notice: Undefined index: username in /in/uk3jT on line 36 Notice: Undefined index: password in /in/uk3jT on line 37 Notice: Undefined index: number in /in/uk3jT on line 38 Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/uk3jT:63 Stack trace: #0 {main} thrown in /in/uk3jT on line 63
Process exited with code 255.
Output for hhvm-3.12.0
Notice: Undefined index: username in /in/uk3jT on line 36 Notice: Undefined index: password in /in/uk3jT on line 37 Notice: Undefined index: number in /in/uk3jT on line 38 exception 'Exception' with message 'String could not be parsed as XML' in /in/uk3jT:79 Stack trace: #0 /in/uk3jT(79): SimpleXMLElement->__construct() #1 {main}
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.3.28 - 5.3.29, 5.4.20 - 5.6.28
Notice: Undefined index: username in /in/uk3jT on line 36 Notice: Undefined index: password in /in/uk3jT on line 37 Notice: Undefined index: number in /in/uk3jT on line 38 Fatal error: Call to undefined function curl_init() in /in/uk3jT on line 63
Process exited with code 255.
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.19
Notice: Undefined index: username in /in/ITlPq on line 36 Notice: Undefined index: password in /in/ITlPq on line 37 Notice: Undefined index: number in /in/ITlPq on line 38 Fatal error: Call to undefined function curl_init() in /in/ITlPq on line 63
Process exited with code 255.
Output for 5.0.0 - 5.2.17
Notice: Undefined index: username in /in/ITlPq on line 36 Notice: Undefined index: password in /in/ITlPq on line 37 Notice: Undefined index: number in /in/ITlPq on line 38 Fatal error: Call to undefined function curl_init() in /in/ITlPq on line 63
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '{' in /in/ITlPq on line 11
Process exited with code 255.
Output for 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected '{' in /in/ITlPq on line 11
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/ITlPq on line 11
Process exited with code 255.
Output for 4.3.0
Parse error: parse error, unexpected '{' in /in/uk3jT on line 11
Process exited with code 255.