Add contacts using PHP Api with AgileCRM - php

I have implemented on Add contact to AgileCRM with PHP API then
In agile_curl_wrap function, I have provided three requirements with Domain, User and Api_key after clicking submit, I got 401 UNAUTHORIZE response back.
I'm sure that I have set all requirement needed with this API. I really got stuck in this step.
Thank in advance for any helps.

You can check that gist I've created to show you how it works. Just replace the strings on both files and go on!
In AgileCRM PHP Wrap replace:
define("AGILE_DOMAIN", "yourDomain");
define("AGILE_USER_EMAIL", "yourEmail");
define("AGILE_REST_API_KEY", "yourApiKey");
In AgileCRM PHP Wrap usage replace:
$email = "some#email.com";
And it must work!

I have faced the same issue "401 UNAUTHORIZE". Fixed it by changing AGILE_USER_EMAIL
Please provide your valid admin email of your Agile email id at AGILE_USER_EMAIL area and make sure you have added valid AGILE_DOMAIN and AGILE_REST_API_KEY

Related

Can't send mail with Lumen framework and no error appears

Since yesterday I have had problems sending emails with Lumen. I think I have followed all the steps in the documentation correctly, but unfortunately I cannot send anything. Moreover, no error is displayed (I have activated APP_DEBUG=true), and I am sure that the credentials of the smtp server are correct. I also did composer require illuminate/mail.
Here are my modifications in bootstrap/app.php (I have $app->withFacades(); uncommented).
Here is my build function content: return $this->view('emails.mailTemplate', ['message' => $this->message]);.
And the line of code that ask to send mail: Mail::to("wewanthalflifethree#gmail.com")->send(new sendMail($destEmail, $subject, $message));.
Did I do something wrong? :/
Thx in advance for help!
EDIT: I just noticed something, the code stop working when I send the mail. If I add an echo after Mail::send, it will be appear on the page.
I have a problem with the Exceptions handler. By following this answer (which consists in adding a dd in the render function of Handler.php), I am now able to see what's going wrong.
So, here is the reason why my mail didn't send and why my page turned blank: Object of class Illuminate\Mail\Message could not be converted to string (View: /home/serveur-web/api.sl-projects.com/resources/views/emails/mailTemplate.blade.php).
The problem came from the fact that I was using the variable name $message, and this causes problems because it seems to be used in the class that handles the mails. My problem was therefore solved by renaming this variable $mailContent.
I hope this will help other people. :D

PHP and Google's reCaptcha v2 - empty response every time

We have a contact.html form that uses reCaptcha v2, whose backend processing is in a php file.
I've taken enough steps to understand that when we send the verification to google's api, the response comes back empty. Below is code that gave me this proof.
$url = 'https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST["g-recaptcha-response"].'&remoteip='.$_SERVER['REMOTE_ADDR'];
$verify = file_get_contents($url);
echo $url;
if (empty($verify)) echo 'Failed to fetch data';`
However, when I manually enter the url into a browser, I get a JSON response back that indicates success.
What, then, is the difference? Why would file_get_contents return empty if a simple get request from a Chrome browser give me trouble?
I have read that file_get_contents is synchronous, so I wouldn't expect this is just a noob error on waiting for the response.
Any help would be appreciated, this is my very first time working with PHP. It's not hard, but I may be missing something vital.
Sorry everyone, I can't understand why, but the problem was in the method used to access the site verify.
Using curl syntax, I finally got it working.
Change the configuration in php.ini file and don't need curl.
allow_url_fopen=0 to allow_url_fopen=1

Authorize.net CIM user authentication failed due to invalid authentication values

I am currently experiencing this problem. the thing is that it is working perfectly in test mode, but when we try to use the live id and transaction key, we keep getting the error... I am thinking maybe the request is still trying to post to the test server and we need to force the request to the live one
here is our instantiation code
// authorize.net account credentials
$auth_test_mode = false;
if ($auth_test_mode) {
define("AUTHORIZENET_API_LOGIN_ID", "testid");
define("AUTHORIZENET_TRANSACTION_KEY", "testkey");
} else {
define("AUTHORIZENET_API_LOGIN_ID", "ourid");
define("AUTHORIZENET_TRANSACTION_KEY", "ourkey");
}
any help would be greatly appreciated
thanks!
You also need to specify which URL you are using. The test server and live server use different URLs. If you don't change that, too, you'll get this error.
If you are using authorizenet-php-api, then include this line too:
define("AUTHORIZENET_SANDBOX", false);
Also, FYI, you don't need defines for your API keys, you can use the functions like this:
authorizeNetGetDailyTransaction($account['loginID'],$account['transactionID'])
Which is the only way to do it if you have to login to multiple accounts from the same page.

Recaptcha with magento

I have installed recaptcha in my client's site which is not live yet But in development. The recaptcha was working fine till last week but when I'm checking it now it gives a "Input error: Invalid referer " instead of the recaptcha block.
I am just wondering what might be the cause of this. Is it something to do with the public and private key. ??
Any help would be appreciated
Cheers
yep! It's working for me, I manage over 3 different domains and I was trying to use the same recaptcha keys, I was getting this error " Input error: Invalid referer"
I just create new keys for each of my domains and It works like a charm!
I found the solution its just to do with the public and private key.
For anyone who is having the same problem just go on this link http://www.google.com/recaptcha
and enter keys fro your domain or just 127.0.0.1 and it will work fine.
Cheers

Facebook SDK and Graph API Comment Deleting Error

Working with the Facebook php SDK's, I am having a lot of trouble figuring out how to delete comments, given its id and xid.
At first I was using the REST API, where you can call 'comments_remove($xid, $id);' to delete a comment. The problem with this method came when the xid parameter only accepts alphanumeric characters and underscores.
Based on the documentation (http://developers.facebook.com/docs/reference/fbml/comments ) a valid XID can be the result of any url_encode.
Now I am testing my luck with the new GRAPH api. Looking at http://developers.facebook.com/docs/api under 'Deleting Objects', It seems that comment deleting is definitely supported. However, I have tried sending a DELETE request, and I have also tried sending POST and GET to the object url with the argument 'method=delete'.
No matter how I try it, I always get the same error:
{"error":{"type":"GraphMethodException","message":"Unsupported delete request."}}
I am sending the access token as a parameter as well. The access token that I am sending is the access token saved in the facebook cookie from the single sign on javascript cookie. These are all comments made on my application. Does this happen to anyone else, or am I simply not doing this right?
Any help or guidance is GREATLY appreciated.
Fixed!
You have to prepend the userid to the object ID when deleting:
DELETE https://graph.facebook.com/673509687_104812882909249?access_token={access_token}
where
673509687 is my userID and 104812882909249 is the objectID
Hopefully we can get this looked at:
http://bugs.developers.facebook.com/show_bug.cgi?id=10413
or
http://bugs.developers.facebook.com/show_bug.cgi?id=10434
Try with this:
FB.api('/'+_idComment, 'get', { method:'delete' }, function(response){
//Your code
}

Categories