hi.
there is a website "http://sim.mci.ir/first-step" that sale mobile sim cards.
there is a function in this site that sends request to "
http://sim.mci.ir/get-free-nums[
^]" and gets available numbers.
i want to do this function in vba (excel) and save numbers in cells.
but it doesn't work!
this ajax function in html works, even if i use 'Call CurrentWindow.execScript...' in vba:
var range='9129370';
$.ajax({url: 'http://sim.mci.ir/get-free-nums',data: {range: range},type: 'GET'}).done(function (response) {
response = JSON.parse(response);
var unsortedNumbers = response.numbers;
if (response.status != 'OK') {
$('.suggestion-failed').html('No Service').show();
return;};
if (unsortedNumbers.length == 0) {
$('.suggestion-failed').html('No Range').show(); return;};
var bestMatches = findBestMatchForSuggestion(
unsortedNumbers , '9129370');
if (bestMatches.length != 0) {
$('.suggestion-failed').html('No Range 2').show(); return;};
$('.suggestion-failed').html('Success').show();return;});
but when i use vba code, there is no responseText!!
Set MyRequest = CreateObject("MSXML2.XMLHTTP.6.0")
MyRequest.Open "GET", "http://sim.mci.ir/get-free-nums", False
MyRequest.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"
MyRequest.Send "{range: 9129370}"
what shoud i do? is it pussible to do this in vba directly?