Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aerialglasgow opened this issue Jul 7, 2023 · 0 comments

Comments

@aerialglasgow
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant