Skip to content

Script works in the browser, but fails on CRONJOB, FETCH, or RUN SCRIPT #135

Description

@aerialglasgow

Thanks for the PHP documentation.
I have set up a script which successfully authenticates with API and retrieves public photos responses in JSON by search below:

Unsplash\HttpClient::init([
	'applicationId'	=> 'YOUR ACCESS KEY',
	'secret'	=> 'YOUR APPLICATION SECRET',
	'callbackUrl'	=> 'https://your-application.com/oauth/callback',
	'utmSource' => 'NAME OF YOUR APPLICATION'
]);

Then using
$result = Unsplash\Search::photos($search, $page, $per_page);

When I run the script URL in the browser it works and returns the JSON photos array.

When I try to run the script from the server by CRONJOB, or FETCH, or RUN SCRIPT methods it fails on the first attempt here

\Unsplash\HttpClient::init([ .... });

I've made many changes to try to fix this but without success. Do you know why the script / authentication might be failing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions