How to send post request using Spookyjs with body parameter? - phantomjs

I want to send a post request with JSON body to a particular server using Spookyjs. How I do that please help into this?

If you are using spooky, then you are using nodeJS. Gather your informations (which I'm guessing you want to do) with spooky / casper, pass them back to nodeJS, parse your data and post it.

Related

Can someone explain to me in what language this API code is written in?

I am supposed to create an API using this code. However I am not sure what language this is written in.
You are currently doing a curl using a shell:
See what is a shell(bash for example):
https://fr.wikipedia.org/wiki/Bourne-Again_shell
You are sending data using POST request, and for sending this data you are using a JSON format file.
I think you will have to create a webservice that accept JSON input
https://fr.wikipedia.org/wiki/JavaScript_Object_Notation
Please be more specific in your question, if it is not what you want.

scrapy not visiting url after #

I am writing a scraper for a site. however weird thing is happening, it's not visiting the URL i supply to him. Rather it visits the base url of the website.
I searched on the internet and came to know that, scrapy would ingnore URL after #, I need to indentify the Ajax request being sent and mimic that.
However the problem is. the response of the Ajax request comes as json response. it's not a html content. Would someome please help me how to deal with it.
Following is the url
https://www.buildersshow.com/Search/Exhibitors.aspx#showID=11&state=160&tabname=name
If you investigate the AJAX requests that the page makes, identify the request you need to make and get your response, it should be JSON contained in the response body. To parse it and get your data of interest, use the json decoder/encoder module. Something like this:
import json
mydata = json.loads(response.body)
info = mydata['somekey']
subinfo = mydata['somekey']['subkey']
And so forth. Make sure to handle the json decoder the proper way, it would be best to read the official documentation first.

what does POST stand for in an API header url?

I'm trying to access an API with the pattern POST /api/quotes/params?. . . and GET /api/quotes/3 but I don't know what the POST/GET are for. Am I supposed to replace them with something? I understand normal HTTP GET/POST requests but don't see the relevance in this caseā€¦ please help shed some light.
They are just normal HTTP methods. Generally, GET requests only fetch data, they don't modify anything on the server. POST requests are used to modify data by submiting a post body.
When should I use GET or POST method? What's the difference between them?
They just indicate how you should make your request and/or which methods are available for each endpoint.

How to format an HTTP PUT request?

I am using the Yahoo Placemaker API and would like to send a request but I am getting confused as to how to send the request. The request is composed of a URL and a document and inside the document, there are a bunch of parameters. Please see below.
http://wherein.yahooapis.com/v1/document
documentContent=Sunnyvale+CA
documentType=text/plain
appid=my_appid
How do I format the URL into a request is it like so?
http://wherein.yahooapis.com/v1/documentContent=Sunnyvale+CA?documentType=text/plain?appid=my_appid
I would like to use this the Placemaker service for a Mac app written in objective-c.
Any suggestions would be great. Thanks.
You don't. The URI and the request body are different things.
It would be helpful if you explained why you're asking. What platform/API/language are you using?

how to use https://api.facebook.com/method/fql.query?query=

Hi i need to use https://api.facebook.com/method/fql.query?query= to get user profile picture and other user information on PHP.
i know that https://api.facebook.com/method/fql.query?query= return some json or XML.
but i don't know how to get json to use.
thank you
PHP has built in json support. See json_decode manual.
And if you are wondering how to run FQL from PHP - it was just asked.
You can add a parameter format=json to get result in json format. So the url will be
https://api.facebook.com/method/fql.query?query=fql&format=json&access_token=t
By default format is xml.
The REST API has been deprecated. To make FQL queries you should use the Graph API. To do so, just issue an HTTP GET request to https://graph.facebook.com/fql?q= and provide your FQL statement as the value of the q parameter. For more info, check out the FQL documentation. You can use the Graph API Explorer to easily test FQL queries.