Accessing Online File via API

This thread is now closed to new comments.
Some of the links and information provided in this thread may no longer be available or relevant.
If you have a question please start a new post.
Michael_K
Experienced Partner
20 Posts
Experienced Partner
Australia
Experienced Partner

20Posts

0Kudos

1Solutions

Accessing Online File via API

Hey guys,

 

We've been using the MYOB API on local network for years.

Unfortunately we're now forced to take our company file online.

 

I've been playing around with the following PHP code to get our access code from MYOB.

 

However, what happens is that the code redirects to a login page when I run the PHP code from our local server.

I need to get the code automatically so we can then proceed with connecting to the company file API.

 

Any idea how I can get the return code using PHP and without manually logging in each time an API request is made?

 

We have apps that run every 30 mins so manually logging in each time an API call is made is not practical. Surely there's a better way?

 

Thanks

------------------------------------------------------------------

$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_URL, "https://secure.myob.com/oauth2/account/authorize?client_id=mpednfsn3vgd4gqs3a3g86rr&redirect_uri=htt...");
curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$result = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

print "$httpCode\n";
print "<p>$result</p>";

1 REPLY 1
Leneth_A
MYOB Moderator
2,009 Posts
MYOB Moderator
MYOB Moderator

2,009Posts

86Kudos

253Solutions

Re: Accessing Online File via API

Hi @Michael_K

 

Thanks for your post.

 

For any API error/integration-related queries, we recommend raising a support request via the following link: https://apisupport.myob.com/hc/en-us/requests/new

 


Please don't hesitate to post again if you need help in the future.

 

If my response has answered your enquiry please click "Accept as Solution" to assist other users find this information.

 

Cheers,
Leneth

MYOB Community Forum

Online Help| Forum Search| my.MYOB| Download Page

Did my answer help?

Accept it as a Solution
Leave a to tell others

Didn't find your answer here?

Try using advanced search to find a post more easily Advanced Search
or
Get the conversation started and make a new post Start a Post