0

The codes below is that of a therasus synonymns. The query search word is "refund" I have the following codes

    <html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>


<div id="data"></div>

<script>
var urls = "http://words.bighugelabs.com/api/2/648c23bcbb99d535a06e098b426a5b76/refund/php";

$(document).ready(function() {
    $.get(urls,function(data) {
        $("#data").html(data);
    });
});
</script>       
</body>     
</html>

The response i get is this:

a:2:{s:4:"noun";a:1:{s:3:"syn";a:4:{i:0;s:9:"repayment";i:1;s:8:"defrayal";i:2;s:10:"defrayment";i:3;s:7:"payment";}}s:4:"verb";a:1:{s:3:"syn";a:4:{i:0;s:6:"return";i:1;s:5:"repay";i:2;s:9:"give back";i:3;s:3:"pay";}}}

Now, I don't even understand this. I want to be able to get put into the div only some parts of the response...The wanted words are those on this part "Syn":-

repayment
defrayal
defrayment
payment
return
repay
give back
pay

NOTE: that search words (ie. refund) can change depending on the user query

FRanklinDavid
  • 135
  • 1
  • 6

3 Answers3

1

This looks suspiciously like PHP serialize format: Structure of a Serialized PHP string

https://secure.php.net/manual/en/function.serialize.php

AyrA
  • 763
  • 10
  • 17
0

Check documentation here: https://words.bighugelabs.com/api.php

Your URL ends with /php which according to this documentation returns serialized PHP array. You want to call http://words.bighugelabs.com/api/2/648c23bcbb99d535a06e098b426a5b76/refund/json, note /json at the end.

You're also sharing your API key here, it's better to edit it out. I'll edit my answer if you want me to remove it.

Walk
  • 737
  • 4
  • 15
  • the api is a free api, not paying yet. Thanks for your response on the /json note. I will try out and mark my choosen answer if it works. – FRanklinDavid Oct 20 '17 at 10:02
0

Thanks ALL.

After the Right Answers from @Walk I ended up using

<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>


<p>
<button>Click</button>
<div id="data"></div>

<script>
var urls = "http://words.bighugelabs.com/api/2/648c23bcbb99d535a06e098b426a5b76/refund/json";

$("button").click(function(){
    $.getJSON(urls, function(result){
        $("#data").html("");
        $.each(result, function(key1, value1){
            $.each(value1, function(key, value){
                $("#data").append(String(value).replace(/,/g,"<br>") + "<br>");
            });
        });   
    });
});
</script>       
</body>     
</html>
FRanklinDavid
  • 135
  • 1
  • 6