$ch = curl_init(“https://genderize.p.mashape.com/?country_id=US&language_id=en&name=peter”);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_HTTPGET, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
$optarray=json_decode($output);
print_r($optarray);
this is my code but i am not getting output
Join in the discussion - add comment below:
When using the API through Mashape, you’ll have to append your Mashape API key:
<pre><code>curl --get --include “https://genderize.p.mashape.com/?country_id=US&language_id=en&name=peter”
-H “X-Mashape-Key: 2GwWV8tqXWmshjrC1HZE12AgbWpup10ifrrjsnbJilVdRCRGp0”</code></pre>
Or you can use the API directly. Refer to the documentation at http://genderize.io
Your URL would then look like this:
<pre><code>http://api.genderize.io?name=peter&country_id=US&language_id=en</code></pre>