This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

API calls with JSON formatted results for public/pm output

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
x
x0x
Op
Posts: 140
Joined: Tue Feb 10, 2009 6:42 am

API calls with JSON formatted results for public/pm output

Post by x0x »

I am looking for a script that creates API requests based on public user input.

The API requests return JSON formatted data from a webserver, which needs to be formatted to a pre-defined format and displayed in channel or pm (depending on the initial request).
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

If you can be more specific... examples/commands it would help whoever looks at this post alot including me
x
x0x
Op
Posts: 140
Joined: Tue Feb 10, 2009 6:42 am

Post by x0x »

For users, the program will work like this.

user: !triggera <title>
bot: <most recent result from database>

user: !triggerb <title>
bot: pm: <10 most recent results from database>

The results contain information like title, date, size, category etc.
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

And from where will the data's be retrieved? The best way to get the data's from is an XML/RSS page
x
x0x
Op
Posts: 140
Joined: Tue Feb 10, 2009 6:42 am

Post by x0x »

The only way is with a get request to a php page on https. It will return JSON formatted results.

-edit: I've received an API key
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

Well i need to see the page from where do you want the results to be get from so trigger that page using that API key and copy paste here the source of that page ot see how it looks like and maybe using regexp we will be able to retrive what you want from it
x
x0x
Op
Posts: 140
Joined: Tue Feb 10, 2009 6:42 am

Post by x0x »

curl "https://site.com/req.php?release=title%&key=123456789"

[["TITLE.1","CAT-A",1350000000,"20","274","Comedy_Drama",0,""],["TITLE.2","CAT-B",1340000000,"19","906.0","Drama",0,""],["TITLE.3","CAT-C",1330000000,"6","246.00","Thriller",0,""]]

Like that. So a title, category, unix time, files, size, genre etc.

-edit-

And that needs to look like this in channel for the 1 result trigger:

bot: [title.1] [cat-a] [time] etc.

^ This is the first result from the get request.


The trigger for more results should PM all of the results from the get request and say in channel it's sending a pm.
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

Yes for someone that is good at regexp it shouldnt be that hard :) yet im not good at. But now everyone else that looks to this topic will know what you ask for and maybe they will help you... they now have the souce for the page so its only a regexp apart...
x
x0x
Op
Posts: 140
Joined: Tue Feb 10, 2009 6:42 am

Post by x0x »

I'm really no scripter, but I guess this is some kind of start based on stuff I discovered.

Code: Select all

package require http
package require json

set query [::http::formatQuery release $query key 123456789]
set http  [::http::geturl https://site.com/req.php -query $query]
set json  [::http::data $http]
set data  [::json::json2dict json]
I hope someone is able and willing to help me out.
x
x0x
Op
Posts: 140
Joined: Tue Feb 10, 2009 6:42 am

Post by x0x »

Is it against the rules if I mention I am willing to paypal 20usd (or euro for that matter) as a gift for a working script?
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Offering (or for that part, asking for) payment is not against the forum rules, to my best knowledge. Such arrangements would however be solely between the developer and the customer; if you get huzzled, don't blame egghelp.org or us moderators..

That said, given that your previous thread got junked for violating forum rules, this one is getting borderline going there as well...
NML_375
x
x0x
Op
Posts: 140
Joined: Tue Feb 10, 2009 6:42 am

Post by x0x »

I fully understand and respect that.

Meanwhile someone has responded to my request. We've got the script running for about 75% and he/she received my promised donation. In this case, everyone is happy :)
Q
Qrx
Voice
Posts: 1
Joined: Thu Jan 09, 2014 7:52 pm

Post by Qrx »

I have the same problem. I have been trying to work out how to handle requests/answers regarding a JSON website.

I tried contacting the OP, but he/she is not willing to share the code.

Is there anyone else that is able to give me a hint in the right direction?

What I need:

Request data from a JSON module and put the reply in usable strings so I can make the bot spit them out. The rest of the code I can figure out myself.

Thanks in advance!
Post Reply