You need to sign in to do that
Don't have an account?
Display .php page inside of SFDC
I have a .php page and I can run successfully from wamp server. But now I need to display this .php page inside of Salesforce. Can anyone give me the guidance of how? The following is the .php page:
<?php
$email = $_REQUEST['email'];
$issue_area = $_REQUEST['issue_area'];
$priority = $_REQUEST['priority'];
$description = $_REQUEST['description'];
if (!isset($_POST['submit'])) { // if page is not submitted to itself echo the form
?>
<html>
<head>
<title>Prograde Helpdesk</title>
<style type="text/css">
<!--
.style1 {
color: #000000;
font-family: Verdana, Arial, Helvetica, sans-serif;
text-decoration: none;
font-size: 12px;
}
-->
</style>
<script type="text/javascript">
function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
{
alert(alerttxt);return false;
}
else
{
return true;
}
}
}
function validate_form(thisform)
{
with (thisform)
{
if (validate_required(email,"Email must be filled out!")==false)
{email.focus();return false;}
if (validate_required(issue_area,"Please select an issue category!")==false)
{issue_area.focus();return false;}
if (validate_required(priority,"Please select the Priority of this issue!")==false)
{priority.focus();return false;}
if (validate_required(description,"Please provide a description of the issue!")==false)
{description.focus();return false;}
}
}
</script>
</head>
<body bgcolor="#ccd6dd">
<table align="center" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" style="border:1px solid rgb(0, 0, 0) ">
<tr align="center">
<td align="center" style="padding-top:100px; padding-bottom: 100px;"><table cellspacing="0" cellpadding="0" style="border:1px solid rgb(0, 50, 83)" bgcolor="#CCCCCC">
<tr>
<td>
<div style="width:585px; padding:25px;" align="left" class="style1">
<form method="post" action="<?php echo $PHP_SELF;?>" onsubmit="return validate_form(this)" name="helpdesk">
<table border="0" class="style1" style="font-weight:bold;">
<tr>
<td>Email: </td>
<td><input type="text" size="35" maxlength="50" name="email"><span style="font-size:10px; font-weight:normal">*Required</span></td>
</tr>
<tr>
<td>Issue Category: </td>
<td>
<select name="issue_area">
<option> </option>
<option value="citrix">Citrix</option>
<option value="copier">Copier</option>
<option value="desktop">Desktop</option>
<option value="email">Email</option>
<option value="fax">Fax</option>
<option value="four51">Four51</option>
<option value="ftp">FTP</option>
<option value="internet">Internet</option>
<option value="laptop">Laptop</option>
<option value="network_access">Network Access</option>
<option value="phone">Phone</option>
<option value="printer">Printer</option>
<option value="sap">SAP</option>
<option value="scanner">Scanner</option>
<option value="software_request">Software Request</option>
<option value="vpn">VPN</option>
<option value="website">Website</option>
<option value="suggestion">Suggestion</option>
<option value="shipping_logistics">Shipping</option>
<option value="other">Other</option>
</select><span style="font-size:10px; font-weight:normal">*Required</span>
</td>
</tr>
<tr>
<td>Priority: </td>
<td>
<select name="priority">
<option> </option>
<option value="ads_support">Ads</option>
<option value="store_cards">Store Cards</option>
<option value="east">east</option>
</select><span style="font-size:10px; font-weight:normal">*Required</span>
</td>
</tr>
<tr>
<td valign="top">Description: </td>
<td>
<textarea rows="5" cols="30" name="description" wrap="physical"></textarea><span style="font-size:10px; font-weight:normal">*Required</span>
</td>
</tr>
<tr>
<td colspan="2" align="center"><span style="font-size:10px; font-weight:normal;">If you have files to submit, please reply to your acknowledgement email and attach the files.</span></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="submit" name="submit"></td>
</tr>
</table>
</form>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td><img src="Images/Blue_Bar_Spacer.jpg" width="750" height="26"></td>
</tr>
</table>
</body>
</html>
<?php
}
else {
$url = "http://testhelpdesk.com/tickets.xml";
$request = "<ticket><subject>$issue_area</subject><description>$description</description><set-tags>$priority</set-tags><requester_email>$email</requester_email><fields><307018>$priority</307018></fields><group-id>132872</group-id></ticket>";
$headers = array('Content-type: application/xml','Content-Length: ' .strlen($request));
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERPWD, 'user:password');
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_HEADER, true);
$http_result = curl_exec($ch);
$error = curl_error($ch);
$http_code = curl_getinfo($ch ,CURLINFO_HTTP_CODE);
curl_close($ch);
if ($error) {
print "<br /><br />$error";
} else {
if (preg_match("/Location: .*\/tickets\/(\d*).xml/", $http_result, $matches)) {
$ticket_id = $matches[1];
print "Your issue has been sent to the Helpdesk. Your ticket number is <b>$ticket_id\n</b>. <br />Thank you. <a href='http://helpdesk.prograde.com/progradeops/'>Submit another ticket.</a>";
}
}
}
?>
Would a web tab work? You can create a custom tab under setup, define it as a web tab, and then point it to a URL.
Do I need to host this .php page on a web server?
Yeah, you'll need to host it on a PHP enabled server. Force.com doesn't serve up PHP.