PHP Classes

Fatal error

Recommend this page to a friend!

      Amazon Mechanical Turk PHP REST API  >  All threads  >  Fatal error  >  (Un) Subscribe thread alerts  
Subject:Fatal error
Summary:Got an error in the amt_rest_api.php file
Author:Bharath V
Date:2014-03-25 17:56:55
Update:2014-03-26 18:10:54

  1. Fatal error   Reply   Report abuse  
Bharath V - 2014-03-25 17:56:55

I'm using this mturk php APIs for the first time but i keep getting an error as below:

Fatal error: Uncaught exception 'RuntimeException' with message 'Failed to load from URL supplied' in example\lib\amt-rest-api\amt_rest_api.php on line 1481

I am just trying to connect my code to AWS. I have added both the keys to the keys file and added this to the index.php file:


foreach (new amt\hitlist as $hit) {

Am i doing something wrong?

Please help, once i can do this then i can proceed with my actual project.

Thanks in advance.

  2. Re: Fatal error   Reply   Report abuse  
CPK Smithies - 2014-03-26 17:19:32 - In reply to message 1 from Bharath V
I don't see that you are doing anything wrong. Here is a minimal program that should work:

require 'amt_rest_api.php';
$balance = amt\balance_request::execute();
echo "Balance is $balance\n";

You can run this program from the command line. Let me know if this generates the same error.

  3. Re: Fatal error   Reply   Report abuse  
CPK Smithies - 2014-03-26 18:10:54 - In reply to message 1 from Bharath V
If you still experience the same error with the little program I gave in the last reply, then try editing amt_rest_api.php and removing the '@' sign before the file_get_contents() call in line 1475. Then re-run the program and let me know what error was displayed. (N.B. you need to do this from the command line.)