I have to connect to an API from PHP and use the result as variables. I have a sample connection using Javascript in attachment.
Working Javascript
<script>
$(function () {
var baseUrl = '[login to view URL]';
var uid = 'username';
var pwd = 'password';
GetArtigo('QQ2-00012', '1');
function GetArtigo(cod_prod, qtd) {
[login to view URL] = true;
$.ajax({
url: baseUrl + 'api/Artigo?referencia=' + encodeURIComponent(cod_prod) + '&qtd=' + qtd,
type: 'GET',
jsonp: "callback",
dataType: 'jsonp',
username: uid,
password: pwd,
success: function (data, textStatus, xhr) {
[login to view URL](data);
},
error: function (xhr, textStatus, errorThrown) {
alert([login to view URL]);
}
});
}
});
</script>
I
hi,
I am interested to write php code to connect api and return result in a variable. Please see my previous works in my profile and consider my bid to work in this project.
Thanks
Prakash
Hi!
If I understand correctly, you want to do what this Javascript does in PHP, right? So basically you need a PHP script that connects to the API and stores the results in a variable? Please let me know. I am online so you can PM me. I can deliver within an hour or maybe even faster.
Thanks,
Ayush
Hi,
I have around 7 years of experience working on PHP and i can get this done for you quicker and efficiently. It is just API hit from PHP and parsing response to use as variables.