Issue with Request_Curl
vlkinc opened this issue · 3 comments
vlkinc commented
Hello everyone, just installed fuel framework,
Try to make a curl request, and have 404 on step ->execute()
Where I am wrong?
$curl = \Fuel\Core\Request::forge('https://google.com', 'curl')
->set_method('get')
->set_header($authConfig['header_key'], $authConfig['auth_key'])
->set_mime_type('json')
->execute()
->response();
composer.json
{
"name": "fuel/fuel",
"type": "project",
"description" : "Lorem",
"keywords": ["application", "website", "development", "framework", "PHP", "PHP7"],
"license": "MIT",
"require": {
"php": ">=5.3.3",
"composer/installers": "~1.0",
"fuel/core": "1.8.*",
"fuel/auth": "1.8.*",
"fuel/email": "1.8.*",
"fuel/oil": "1.8.*",
"fuel/orm": "1.8.*",
"fuel/parser": "1.8.*",
"fuelphp/upload": "2.0.6"
},
"require-dev": {
"fuel/docs": "1.8.*"
},
"config": {
"vendor-dir": "fuel/vendor"
},
"extra": {
"installer-paths": {
"fuel/{$name}": ["fuel/core"],
"{$name}": ["fuel/docs"]
}
},
"scripts": {
"post-install-cmd": [
"php oil r install"
]
},
"minimum-stability": "stable"
}
WanWizard commented
I'm not getting a 404, I get a
OutOfRangeException [ Error ]:
The mimetype "text/html" of the returned response is not acceptable according to the accept header sent.
Which is logical, as google doesn't return data in json format?
WanWizard commented
Use
try
{
$curl = \Fuel\Core\Request::forge('https://some/json/url/here, 'curl')
->set_method('get')
->set_header($authConfig['header_key'], $authConfig['auth_key'])
->set_mime_type('json')
->execute()
->response();
\Debug::dump($curl);
}
catch (\Exception $e)
{
\Debug::dump($e);
}
die();
to make sure you can see what you are doing. Also, run the app in the "development" environment (which is default) so you can actually see error messages.
vlkinc commented
Thank you,
Google url was just an example.
Debug helped a lot. The issue was in environment. I try to get response from the url which respond with 500, i fix that already so everything works fine.
Problem solved