I am using the PHP OAuth extension to connect to the Netflix API and pull data through a GET request.
Running the request on my local machine results in a successful try and the correct data returned.
However, upon pushing the request up to our 'live' server, I've immediately run into issues with the PHP OAuth extension failing.
I am using version 1.2.2 of the extension with curl as my request method (libcurl is also installed). My PHP code to call the OAuth fetch is:
$oauth = new OAuth($this->key, $this->secret);
$resource = $oauth->fetch($url, array('v' => '2.0', 'include_tms' => 'true'));
$this->_writeFile($oauth->getLastResponse());
Again, this exact code works 100% on my local dev machine (Mac running OS X Lion, installed php-oauth through MacPorts ... also version 1.2.2 ... PHP 5.3.8). However, when running on our server (Debian Linux, PHP 5.3.3, installed php-oauth through apt-get) I receive the following error:
PHP Fatal error: Uncaught exception 'OAuthException' with message 'making the request failed (Failure when receiving data from the peer)' in /var/www/familymedia/application/Services/Netflix.php:23
I'm really not sure what to make of this error.
Some further info:
We currently make successful cURL requests from our server to other API services and return back good information without issue on an hourly basis. However, none of those services authenticate through OAuth, so none of them required the OAuth extension and I ran them straight with php curl.
I have a feeling that there is some sort of setup issue with the php-oauth extension on our live server that MacPorts "magically" solved for me during install on my local machine ... but I cannot find any install or configuration advice/instruction/etc that has helped.
Hoping someone has an answer or a place to point me for further discovery toward an answer ...
Thought I'd update this question with the answer found: the company was specifically blocking inbound communication from Netflix. IT solved the issue. Not a very exciting answer, but that's what it was.
Related
I have used the standard MailJet wrapper and php script to produce an email from our website. We are using the php wrapper for this.
I installed the wrapper using composer so believe we have all the correct dependencies.
When executing the script it works up until the following line:
$response = $mj->post(Resources::$Email, ['body' => $body]);
We have input the correct API and Secret keys and are running php 7.3.13 on the server.
I believe the code is correct as if i copy the website onto a shared Linux server it all runs to completion and we receive an email. I suspect that there is a flag or standard php add on we might require that is available on our shared server but not the windows one.
We just did a bog standard install of php on the server using the web platform installer as was recommended.
If anyone has any ideas as to what could be missing i would be grateful! Im not big on php so apologies if it is something stupid.
Thanks,
Simon
Thanks for helping, after getting to the logs i found that i needed to update the settings for curl in my php.ini file to point to the cacert File i downloaded from their website. Now this is set its running and sending messages.
PHP REST Api used for Dialog Flow detectIntent() function gives internal server error.
We are connecting to Google Dialog flow service from AWS EC2 instance. But we are receiving internal server error 500.
I have tried many solution, I initially thought it was AWS EC2 Instance problem because Dialog flow code is working fine to my local windows server but not on AWS server.
After few research, i found that it was the problem of bcMath module which is not installed on my EC2 Instance php setting.
Following are the steps to install bcMath module on PHP -
1. First check if you have bcMath. Check this using phpinfo(); function.
2. Use following command to install bcMath on your AWS instance php -
$sudo yum install php55-bcmath
I finally got my site working on my laptop, uploaded it and am getting the error:
exception 'PayPal\Exception\PayPalConnectionException' with message 'Unsupported SSL protocol version'
So I'm thinking the host having:
TLS 1.0OpenSSL/0.9.8bOpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
is my problem most likely.
My question: If my host (who shall remain nameless for now) refuses to update OpenSSL is there anything I can do to fix/work around and avoid getting another host?
I've had a quick look at https://www.madboa.com/geek/openssl/ but its a bit out of my depth to quickly know if I could download a newer version of OpenSSL configure it on the shared server and run the commands to encrypt/decrypt messages with PayPal directly with the exec command.
Yes I know, if it worked it would be a dogs breakfast but it might see me through until my host eventually pulls their finger out from where it currently is.
I've created an application in php that sends texts out to people using the twilio api. It works perfectly in XAMPP but the php code doesn't run in Azure. Everytime I call it I get an error message saying "Failed to load resource: the server responded with a status of 500 (Internal Server Error)".
Is there a way I can solve this problem without having to create my own virtual server?
Usually, when we get 500 response, it means we get some errors on server scripts. And we can set the display_errors=On in PHP runtime on our Azure Web Apps for easy troubleshooting. Refer to https://azure.microsoft.com/en-in/documentation/articles/web-sites-php-configure/#how-to-change-the-built-in-php-configurations for details.
And you may check whether your application on Azure Web Apps has successfully installed the twilio lib. You can leverage composer to configure the sdk in composer.json, then when you deploy your application to Azure via Git, Azure service will install the dependencies in composer.json file automatically during the deployment task.
You can leverage require 'vendor/autoload.php' to load all the dependencies.
At the first time during the test, I got the following error:
Fatal error: Uncaught exception Services_Twilio_TinyHttpException with message SSL certificate problem...
So it may be the issue on your side too, you can add the certificate in PHP on Azure Web Apps, please refer to https://blogs.msdn.microsoft.com/azureossds/2015/06/12/verify-peer-certificate-from-php-curl-for-azure-apps/ for detailed steps.
Otherwise, you can simply edit TinyHttp.php in twilio lib:
add CURLOPT_SSL_VERIFYPEER => FALSE, at $opts array.
Refer to Twilio PHP - SSL certificate: self signed certificate in certificate chain for the same issue.
They have many possibles:
Your Azure running PHP in ISS Server, then you need convert your .htaccess file to web.config, simple, just go to website in IIS and on import your .htaccess file, IIS will convert your .htaccess in web.config.
Permissions on folder you are running.
PHP versions, check your PHP version on xampp and compare to PHP version on Azure. Your code can be compatible in your PHP Xampp but not in PHP Azure.
Extensions PHP, it is possible that your xampp has extensions for PHP enable that your Azure not are enable, like file_info, etc...
I have a running LARAVEL based website on a shared hosting (Business Plan) with Hostgator India. Ee decided to migrate it to a recently purchased dedicated server. The content transfer/migration was successful, however, when I try to LOGIN/REGISTER using the default laravel methods on the dedicated server I get following exception:
PDO Exception: The server requested authentication method unknown to the client
After, researching a lot on Google / StackOverflow I discovered that there could be a mismatch in the server mysql version. However, I am not able to understand how to get it fixed. I am currently using a PHP 5.5 (Also tried PHP 5.4 with no success). Downgrading it to PHP 5.3 would work, with its own sweet problems for "syntax errors" and requires quite a lot of the change in the code. The code works absolutely fine on the business plan and my local MAMP server. I am sure I am missing something very small here and would be really thankful if someone could point me in right direction.
Edit 1: MySql information on Server
Server type: MySQL
Server version: 5.5.37-cll - MySQL Community Server (GPL)