Get all smart contact events

Can someone please point me in the right direction?

I am looking to call “eth_newFilter” using PHP (laravel).

I keep getting “invalid json request” even though I think I am sending the correct data.

Note: Laravel does send content type “application/json” as default.

Please see attached.

Hi @rocketvalley, and welcome to the Infura community!

This seems like a very trivial thing, but what happens if you switch your single quotes to double quotes? JSON requires double quotes, so I’m thinking this may be a syntax issue (versus a data sent issue) :slight_smile:

Hey,

Thank you for your reply. I did think of this, however, quotes are not the cause. I am using Laravel and it will automatically convert the data to json.

If I intercept the request, here is actually what Laravel is sending:

{
   "id":1000,
   "jsonrpc":"2.0",
   "method":"eth_newFilter",
   "params":{
      "topics":[
         "0x3b54244fd9f24308e8af20c841d18d51e8bf31c6d418e821cbac244814600456",
         null,
         "0x00000000000000000000000088f16f368c847b437db3396ce2ab62b14383c6c7"
      ],
      "fromBlock":"0x0",
      "toBlock":"latest",
      "address":[
         "0xfEf0d2f3A79b4338d8418003Dd9df89281242063"
      ]
   }
}

Any help would be greatly appreciated, my friend send the exact same JSON to the endpoint using python and it worked fine.

For example, if I send this…

It works.

Thanks for providing the additional information! I’m not the most familiar with PHP/Laravel, but I’ll see if I can help you figure out what’s going on! I know that Laravel sends content type “application/json” as default, but have you tried to explicitly state it?

If that doesn’t work, can you please copy the full error message for me to see if that helps guide me on where to look?

Thanks!