Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NLC - create - $info['description'] and $info['code'] #1

Open
SBreuer opened this issue Feb 20, 2017 · 6 comments
Open

NLC - create - $info['description'] and $info['code'] #1

SBreuer opened this issue Feb 20, 2017 · 6 comments

Comments

@SBreuer
Copy link

SBreuer commented Feb 20, 2017

Hello,

thx for your SDK, it helps me a lot. but I have a small Problem. In the NaturalLanguageClassifier.php, if there is an invalid Response (from line 117), it keeps telling me Notice: Undefined index: description ... and Notice: Undefined index: code. If I look at the curl_getinfo Definition, there are no fields like the mentioned in the results. Did there something Change or did I miss something? Sorry, if that is the case, I am quite new to this :)

@keithweaver
Copy link
Owner

Thanks for the feedback! Glad you like it. I'll look into it and try to get back to you in a few.

@keithweaver
Copy link
Owner

@SBreuer
If you add an echo or print_r before that and print the $result variable, is it null? What does it look like? That's my initial thoughts would be result is coming in blank. 200 is for a successful call, so I'd be curious what you have returning. If this is the issue, please still respond so I know. I'll try to recreate the error on my own machine.

@keithweaver
Copy link
Owner

I ran the example to check if the API had changed, but it seems to be working. I ran this example:
https://github.com/kweaver00/ibm-watson-php-sdk/blob/master/examples/natural-language-classifier/create.php

I attached an image of result. I included the code below and removed the comments. Check for response of some kind. This is the same as the link:

<?php

	require_once "../../src/NaturalLanguageClassifier.php";
	
	$naturalLangObj = new \Kweaver\Watson\NaturalLanguageClassifier();
	
	//Set your IBM Watson Bluemix Service Credentials
	$naturalLangObj->setServiceCredentials("YOUR_USERNAME","DON_T_FORGET_TO_CHANGE_THIS");
	$localFilePathForTrainingMetaDataJSON = realpath("./new_training_data_meta_data.json");
	$localFilePathForTrainingData = realpath("./weather_data_train.csv");
	$response = $naturalLangObj->create($localFilePathForTrainingData,$localFilePathForTrainingMetaDataJSON);
	print_r($response);
?>

screen shot 2017-02-20 at 7 48 43 am

@SBreuer
Copy link
Author

SBreuer commented Feb 20, 2017

Sorry, if I caused some confusion. Everything works great if the URL is right and so on. Then you wont come to this error case. I got there, because my PHP Interpreter did not have the right SSL certificates and so curl_getinfo returned 0. And then i got into this case with the above mentioned Errors. After I added the SSL certificates to the php.ini, everything works great, as the Error-case wont be entered.

@SBreuer
Copy link
Author

SBreuer commented Feb 20, 2017

So it works, everything is fine, but IF there is something wrong, the fields description and Code in $info dont exist.

@keithweaver
Copy link
Owner

Okay thanks. I'll continue looking for/creating a permanent solution for this in the near future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants