Comments (30)
this is my php form
<style> .error { color: #FF0000; } </style><?php
require_once 'vendor/autoload.php';
use AlexaCRM\CRMToolkit\Client as OrganizationService;
use AlexaCRM\CRMToolkit\Settings;
use AlexaCRM\CRMToolkit\Entity\EntityReference;
$options = [
'serverUrl' => '*********',
'username' => '**********************',
'password' => '',
'authMode' => 'OnlineFederation',
];
$serviceSettings = new Settings( $options );
$service = new OrganizationService( $serviceSettings );
$contact = $service->entity( 'contact' );
$contact->firstname = 'John';
$contact->lastname = 'Doe';
$contact->emailaddress1 = '[email protected]';
$guid = $contact->create();
// define variables and set to empty values
$nameErr = $emailErr = $genderErr = $websiteErr = "";
$name = $email = $gender = $comment = $website = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($_POST["name"])) {
$nameErr = "Name is required";
} else {
$name = test_input($_POST["name"]);
// check if name only contains letters and whitespace
if (!preg_match("/^[a-zA-Z-' ]*$/", $name)) {
$nameErr = "فقط حروف مجازه";
}
}
if (empty($_POST["email"])) {
$emailErr = "Email is required";
} else {
$email = test_input($_POST["email"]);
// check if e-mail address is well-formed
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$emailErr = "Invalid email format";
}
}
if (empty($_POST["website"])) {
$website = "";
} else {
$website = test_input($_POST["website"]);
// check if URL address syntax is valid (this regular expression also allows dashes in the URL)
if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $website)) {
$websiteErr = "Invalid URL";
}
}
if (empty($_POST["comment"])) {
$comment = "";
} else {
$comment = test_input($_POST["comment"]);
}
if (empty($_POST["gender"])) {
$genderErr = "Gender is required";
} else {
$gender = test_input($_POST["gender"]);
}
}
function test_input($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
<h2>PHP Form Validation Example</h2>
<p><span class="error">* required field</span></p>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>">
Name: <input type="text" name="name" value="<?php echo $name; ?>">
<span class="error">* <?php echo $nameErr; ?></span>
<br><br>
E-mail: <input type="text" name="email" value="<?php echo $email; ?>">
<span class="error">* <?php echo $emailErr; ?></span>
<br><br>
Website: <input type="text" name="website" value="<?php echo $website; ?>">
<span class="error"><?php echo $websiteErr; ?></span>
<br><br>
Comment: <textarea name="comment" rows="5" cols="40"><?php echo $comment; ?></textarea>
<br><br>
Gender:
<input type="radio" name="gender" <?php if (isset($gender) && $gender == "female") echo "checked"; ?> value="female">Female
<input type="radio" name="gender" <?php if (isset($gender) && $gender == "male") echo "checked"; ?> value="male">Male
<input type="radio" name="gender" <?php if (isset($gender) && $gender == "other") echo "checked"; ?> value="other">Other
<span class="error">* <?php echo $genderErr; ?></span>
<br><br>
<input type="submit" name="submit" value="Submit">
</form>
<?php
echo "<h2>Your Input:</h2>";
echo $name;
echo "<br>";
echo $email;
echo "<br>";
echo $website;
echo "<br>";
echo $comment;
echo "<br>";
echo $gender;
?>
from php-crm-toolkit.
how to solve this error?
from php-crm-toolkit.
@Mehran16007 not sure what the error is as you didn't include it. Are you referring to the unresolved references? Have you run composer as documented?
from php-crm-toolkit.
@Mehran16007 not sure what the error is as you didn't include it. Are you referring to the unresolved references? Have you run composer as documented?
Thanks for your replay, No i didn't run composer i just copy the toolkit codes into my php form file and i got this error.
from php-crm-toolkit.
from php-crm-toolkit.
Well, you do need to run composer to bring vendor libraries and references in.
from php-crm-toolkit.
Well, you do need to run composer to bring vendor libraries and references in.
Ok georged, i install composer in my project folder, now i got this error
from php-crm-toolkit.
Your Dynamics 356 URL is d365.mehran.lab, I assume it's a private Dynamics 365 instance. It must be configured as Internet Facing Deployment instance + it must use https: protocol.
from php-crm-toolkit.
Your Dynamics 356 URL is d365.mehran.lab, I assume it's a private Dynamics 365 instance. It must be configured as Internet Facing Deployment instance + it must use https: protocol.
Ok, So i have to configure IFD internally, am i correct? But i got still same error in my php form code is this normall?
from php-crm-toolkit.
No it's not normal. You have not resolved the references. Have you run composer? Did the vendor folder get created? Does it contain the referenced libraries? This is more or less standard wiring.
from php-crm-toolkit.
from php-crm-toolkit.
No it's not normal. You have not resolved the references. Have you run composer? Did the vendor folder get created? Does it contain the referenced libraries? This is more or less standard wiring.
and this is my references, i dont now if it be correct or not
from php-crm-toolkit.
@Mehran16007 you need to run composer. References will not resolve until you do.
$ composer require alexacrm/php-crm-toolkit:dev-master
from php-crm-toolkit.
@Mehran16007 you need to run composer. References will not resolve until you do.
$ composer require alexacrm/php-crm-toolkit:dev-master
where should i do that ? i did run this command in cmd with path of my project folder and the command create the vendor folder and composer.json in my project folder but i still get this error, what else shall i do ?
from php-crm-toolkit.
@Mehran16007 you need to run composer. References will not resolve until you do.
$ composer require alexacrm/php-crm-toolkit:dev-master
should i change these three path ? if yes, to where ?
from php-crm-toolkit.
run composer in the same folder as your test php file. that will create vendor folder and the references become valid.
from php-crm-toolkit.
run composer in the same folder as your test php file. that will create vendor folder and the references become valid.
I already did that George, look at the photos that i sent, here another thing i got this error on my wamp server menu, what is it? how to solve it? is it relate to previous error?
when i install composer i chose the wamp php path for the composer, can be for this?
from php-crm-toolkit.
May you please remote to my system and see what's going on.
from php-crm-toolkit.
run composer in the same folder as your test php file. that will create vendor folder and the references become valid.
I already have VENDOR folder in my test folder and it has all References
from php-crm-toolkit.
the issue seems to be your php install/configuration. If you're able to run a simple 'hello, world' php code in the test folder then all references seems to be in place and you should be able to run our sample code as well.
from php-crm-toolkit.
the issue seems to be your php install/configuration. If you're able to run a simple 'hello, world' php code in the test folder then all references seems to be in place and you should be able to run our sample code as well.
There is no problem with running sample hello world or a simple php form in that folder, the problem begin where these two line of code, when i run the program in browser the error is not about that two line error its about the IFD configuration of dynamics crm and the certificate. I'm not php expert may you help me to solve these two line error, maybe with remote to my system as well.
from php-crm-toolkit.
@Mehran16007 if the errors are about the IFD configuration then it's not a php problem at all. You must have IFD configured and use https otherwise you won't be able to connect to the instance.
from php-crm-toolkit.
@georged Where should i put this line "As a temporary cure, add 'ignoreSslErrors' => true to the Settings." to not check the certificate ?
from php-crm-toolkit.
@Mehran16007 this is not the purpose of this flag and it's not going to work. The requirements are clear: the server must be configured for IFD and that includes correct SSL certificate. See documentation
from php-crm-toolkit.
@georged I configured IFD internally but I got this error, I think the error is because of my certificate coz its internal certificate.
Fatal error: Uncaught Exception: Could not retrieve WSDL at https://mehran.mehran.lab/XRMServices/2011/Organization.svc?wsdl in C:\wamp64\www\test\vendor\alexacrm\php-crm-toolkit\src\Client.php on line 2227
from php-crm-toolkit.
@georged I want to put this flag to not consider the SSL but I don't know where to put this flag ?
from php-crm-toolkit.
$options = [
'serverUrl' => '*********',
'username' => '**********************',
'password' => '',
'authMode' => 'OnlineFederation',
ignoreSslErrors => false
];
It's not strictly speaking what it's there for but you can try.
from php-crm-toolkit.
@georged I test it with value of True but got this error.
Fatal error: Uncaught Exception: Invalid SOAP Response: HTTP Response 503 <TITLE>Service Unavailable</TITLE>
Service Unavailable
HTTP Error 503. The service is unavailable.
in C:\wamp64\www\test\vendor\alexacrm\php-crm-toolkit\src\Client.php on line 1274from php-crm-toolkit.
@Mehran16007 most likely your deployment isn't configured correctly. I'm sorry but this has nothing to do with the toolkit and google is your best friend. For example, this could be one of the reasons : https://support.microsoft.com/topic/http-503-service-unavailable-error-while-accessing-the-microsoft-dynamics-crm-federation-metadata-url-after-configuring-the-claims-based-authentication-6a5dde13-19c3-89d1-f8f5-fe82e0ac7dd7
from php-crm-toolkit.
@georged I finally got it working, Thank you for all your replay George, you route me to the correct direction.
from php-crm-toolkit.
Related Issues (20)
- Create an email in Dynamics 365 using AlexaCRM php-crm-toolkit HOT 6
- Cannot use “contain-values” operate for multiselect optionsets attribute in FetchXML.
- Datetime type field fetch and not coming correct format HOT 1
- How to catch if the authentication failed HOT 1
- Get records by date or latest records not all HOT 1
- How to retrieve id from this data HOT 3
- Is there any way to fetch opportunities with lineitems HOT 1
- Uncaught exception 'Exception' with message 'Could not retrieve WSDL HOT 6
- Need sample code for pagination HOT 1
- Need Query on contact in crm and put condition on create or sending task to crm user HOT 1
- Error when authenticating: Ws-Trust HOT 22
- Oauth HOT 1
- Performance of creating a contact HOT 3
- Ws-Trust authentication has been deprecated HOT 1
- Create new or Update if exists HOT 1
- Integration broken because disco.crm.dynamics.com is returning 404 HOT 3
- How to authenticate Multi Server URLs Using one azure Application credentials. HOT 5
- Could not find ExecuteResult node in XML returned from Server Error HOT 1
- Exception deserializing entity
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-crm-toolkit.