I have a project on www.bluemix.net that uses PHP. I try to send an HTTP request as shown in the code below, but I never reach the {echo "b";} command. I think that the HTTP request is not enabled, by default, when PHP is used on Bluemix.
<?php
error_reporting(E_ALL);
echo "a";
$request = new HttpRequest(); // I never pass this line
echo "b";
$request->setUrl('https://stream.watsonplatform.net/speech-to-text/api/v1/recognize');
$request->setMethod(HTTP_METH_POST);
?>
Has anyone used Bluemix this way and had the same issue with using an HTTP request?
Hint: The project structure looks as follows:
[SOLVED] The issue is solved now, all I needed was to download the application to my computer, and install composer locally, followed by pushing the whole thing to bluemix.
I believe that is not the best way, because I prefer to code directly on the cloud. Whatsoever, I'll summarize the steps that can be used to run HttpRequest with IBM bluemix:
Go local to your computer, inside your application folder, modify the file composer.json to include any http package. For me, I used php-curl, so the file looks like
{
"require": {
"php-curl-class/php-curl-class":"*"
}
"minimum-stability": "dev"
}
Install the package using composer locally
php composer.phar install
Now, everything is ready we should push the whole application back to bluemix:
Login to blue mix using username and password
bluemix login
connect to IBM blue mix
bluemix api https://api.ng.bluemix.net
Push the application, where matches your application name
cf push <app_name>