Documentation

Basic Usage

Custom Headers

Sessions

Geographic Location

POST Requests

Headless Browser

 

 

Basic Usage

Syphoon’s API provides a single API endpoint and a simple POST request sent to https://api.syphoon.com carrying three mandatory query string parameters, for effortless crawling. These parameters consist of your API key, a method that contains the type of request you want to make (GET/POST), and the target URL you
want to crawl.

Sample Code

 

curl -d "key=YOUR_API_KEY&url=http://httpbin.org/ip&method=GET" -X POST "https://api.syphoon.com"

import requests

apiData = {“key”: “YOUR_API_KEY”, “method”: “GET”, “url”: “http://httpbin.org/ip”}

response = requests.post(“https://api.syphoon.com”, data= apiData )

{
"origin": "assigned_ip_address" }

Custom Headers

To get customized results, you may want your requests to pass through custom headers (like cookies, agents, etc). To maintain primary request headers, have keep_headers=true
We handle blocks internally, therefore, use this feature only when you require customized results.

Sample Code

 

curl --header "X-MyHeader: abc" -d "key=YOUR_API_KEY&url=http://httpbin.org/ip&method=GET&keep_headers=true" 
-X POST "https://api.syphoon.com"

import requests

myHeaders = { “X-MyHeader" : "abc"  }

apiData = {“key”: “YOUR_API_KEY”, “method”: “GET”, “url”: “http://httpbin.org/ip”,”keep_headers”=”true”}

response = requests.post(“https://api.syphoon.com”, headers = myHeaders,  data= apiData )

{
"origin": "assigned_ip_address" }

Sessions

To reuse the same proxy for multiple requests, simply use the session_number= flag (e.g. session_number=123). The value of the session can be any integer, simply send a new integer to create a new session (this will allow you to continue using the same proxy for each request with that session number).
Sessions expire 60 seconds after the last usage. When the same proxy is required for multiple subsequent requests, Syphoon has an effortless method. Simply use the &session_number=flag (e.g. session_number=123).
Any integer can represent the value of a session, and all you need to do is send a new integer to create a new session (this will enable you to continue using the same specific proxy for each request corresponding with that session number). Sessions carry an expiry time of 60 secs post last usage.

Sample Code

 

curl -d "key=YOUR_API_KEY&url=http://httpbin.org/ip&method=GET$session_number=123" \
-X POST "https://api.syphoon.com"

import requests

apiData = {“key”: “YOUR_API_KEY”, “method”: “GET”, “url”:”http://httpbin.org/ip”,”session_number”=123}

response = requests.post(“https://api.syphoon.com”, data= apiData)

{
"origin": "assigned_ip_address" }

Geographical Location

Some crawls may require geo-specific proxies for smooth and uninterrupted performance. To facilitate the same, Syphoon can ensure your requests come from a specific country, by simply using the country_code=flag (e.g. country_code=us).
Currently, we provide access to the regions of the United States (us), Canada (ca), United Kingdom (uk), Germany (de), France (fr), Spain (es), Brazil (br), Mexico (mx), India (in), Japan (jp), China (cn), and Australia (au).

 

curl -d "key=YOUR_API_KEY&url=http://httpbin.org/ip&method=GET&country_code=us" -X POST "https://api.syphoon.com"

import requests

apiData = {“key”: “YOUR_API_KEY”, “method”: “GET”, “url”: “http://httpbin.org/ip” , “country_code” = “us”}

response = requests.post(“https://api.syphoon.com”, data=apiData)

{
"origin": "assigned_ip_address" }

POST Requests

Some advanced users will want to issue POST requests in order to scrape forms and API endpoints directly. You can do this by sending a POST request through Scraper API. The return value will be stringified, if you want to use it as JSON, you will want to parse it into a JSON object.

Sample Code

 

curl -d "key=YOUR_API_KEY&url=http://httpbin.org/anything&method=POST" -X POST "https://api.syphoon.com"

import requests

apiData = {“key”: “YOUR_API_KEY”, “method”: “POST”, “url”: “http://httpbin.org/anything”}

response = requests.post( “https://api.syphoon.com”, data= apiData )

{
  "args": {},
  "data": "{\"foo\":\"bar\"}",
  "files": {},
  "form": {},
  "headers": {
    "Accept": "application/json",
    "Accept-Encoding": "gzip, deflate",
    "Content-Length": "13",
    "Content-Type": "application/json; charset=utf-8",
    "Host": "httpbin.org",
    "Upgrade-Insecure-Requests": "1",
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko"
  },
  "json": {
    "foo": "bar"
  },
  "method": "POST",
  "origin": "XX.XXX.XXX.XXX, XX.XXX.XXX.XXX",
  "url": "https://httpbin.org/anything"
}

Headless Browser

While crawling a page, it may require you to render the JavaScript on that page. Using a headless browser, we can easily fetch such pages for you. To enable JavaScript rendering, all you need to do is set render=true and we will use a headless Google Chrome instance to fetch the page.

Sample Code

 

curl -d "key=YOUR_API_KEY&url=http://httpbin.org/ip&method=GET&render=true" -X POST "https://api.syphoon.com"

import requests

apiData = {“key”: “YOUR_API_KEY”, “method”: “GET”, “url”: “http://httpbin.org/ip” , “render” : “true”}

response = requests.post(“https://api.syphoon.com”, data= apiData)

{
"origin": "assigned_ip_address" }