I started using the AlchemyAPI key to extract json/xml data from url's. The alchemy url api key works just great when entered along with the queried url but I wanted the url part to come from the user side so first I created a form with the following code:
<form method="post" class="SearchCSS" action="/NENSearch.php?go" id="categorizer">
<h1>Enter your Queries</h1>
<input type="text" name="Search" placeholder="Enter the article URL">
<input type="submit" value="Search">
</form>
Then using PHP passed the user's submitted url into the endpoint of the alchemy api and stored the json data into a variable and later displayed the parsed data using the following code (Problem: Code actually doesn't display anything):
<?php
echo "this works here";
if(isset($_POST['submit'])){
if(isset($_GET['go'])){
if(preg_match("%^((http?://)|(www\.))([a-z0-9-].?)+(:[0-9]+)?(/.*)?$%i", $_POST['Search'])){
$url=$_POST['Search'];}
echo $url;}
$response = file_get_contents("http://gateway-a.watsonplatform.net/calls/url/URLGetCombinedData?extract=page-image,entity,keyword,taxonomy&apikey=1f324507a9d516d9429e14f970ccc83de9df2&showSourceText=1&sentiment=1&outputMode=json"ations=1&url='.$url.'");
$response = json_decode($response);
echo $response;}
echo "<br/> this is not working";
?>
The basic alchemyAPI url I used looks like this (drupal url added at the end) : http://access.alchemyapi.com/calls/url/URLGetRankedTaxonomy?apikey=1f324507a9d51694a29e14f970ccc83de9df2&outputMode=jsonp&knowledgeGraph=1&extract=taxonomy&url=https://www.drupal.org/node/2148541
I just started working with API's and Any help in displaying the parsed json data into html form will be of great help. Thanks in advance. :)