3v4l.org

run code in 300+ PHP versions simultaneously
<?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 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Warning: Undefined array key "username" in /in/TtBOn on line 36 Warning: Undefined array key "password" in /in/TtBOn on line 37 Warning: Undefined array key "number" in /in/TtBOn on line 38 Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/TtBOn:63 Stack trace: #0 {main} thrown in /in/TtBOn on line 63
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
Notice: Undefined index: username in /in/TtBOn on line 36 Notice: Undefined index: password in /in/TtBOn on line 37 Notice: Undefined index: number in /in/TtBOn on line 38 Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/TtBOn:63 Stack trace: #0 {main} thrown in /in/TtBOn on line 63
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.26
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/TtBOn:63 Stack trace: #0 {main} thrown in /in/TtBOn on line 63
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.28
Notice: Undefined index: username in /in/TtBOn on line 36 Notice: Undefined index: password in /in/TtBOn on line 37 Notice: Undefined index: number in /in/TtBOn on line 38 Fatal error: Call to undefined function curl_init() in /in/TtBOn on line 63
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Notice: Undefined index: username in /in/TtBOn on line 36 Notice: Undefined index: password in /in/TtBOn on line 37 Notice: Undefined index: number in /in/TtBOn on line 38 Fatal error: Call to undefined function curl_init() in /in/TtBOn on line 63
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '{' in /in/TtBOn on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected '{' in /in/TtBOn on line 11
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/TtBOn on line 11
Process exited with code 255.

preferences:
246.45 ms | 401 KiB | 376 Q