LogoLogo
Release NotesDataPipelineFAQs
PHP
PHP
  • Making Requests
    • API Endpoint Method
    • Proxy Port Method
    • SDK Method
    • Async Requests Method
      • How to use
      • Callbacks
      • API Parameters
      • Async Batch Requests
      • Decoding
    • Structured Data Collection Method
      • Amazon Product Page API
      • Amazon Search API
      • Amazon Offers API
      • Amazon Reviews API
      • Ebay Product Page API
      • Ebay Search API
      • Google SERP API
      • Google News API
      • Google Jobs API
      • Google Shopping API
      • Google Maps Search API
      • Redfin Agent Details API
      • Redfin 'For Rent' Listings API
      • Redfin 'For Sale' Listings API
      • Redfin Listing Search API
      • Walmart Search API
      • Walmart Category API
      • Walmart Product API
      • Walmart Reviews API
    • Async Structured Data Collection Method
      • Amazon Product Page API (Async)
      • Amazon Search API (Async)
      • Amazon Offers API (Async)
      • Amazon Reviews API (Async)
      • Ebay Product Page API (Async)
      • Ebay Search API (Async)
      • Google Search API (Async)
      • Google News API (Async)
      • Google Jobs API (Async)
      • Google Shopping API (Async)
      • Google Maps Search API (Async)
      • Redfin Agent Details API (Async)
      • Redfin 'For Rent' Listings API (Async)
      • Redfin 'For Sale' Listings API (Async)
      • Redfin Listing Search API (Async)
      • Walmart Search API (Async)
      • Walmart Category API (Async)
      • Walmart Product API (Async)
      • Walmart Reviews API (Async)
    • Making POST/PUT Requests
    • Customizing Requests
      • Amazon ZIP Code Targeting
      • Cached Results
      • Cost Control
      • Custom Headers
      • Device Type
      • Geotargeting
      • Geotargeting (Premium)
      • Parameters as Headers
      • Premium Residential/Mobile Proxy Pools
      • Rendering Javascript
        • Render Instruction Set
        • Screenshot Capture🆕
      • Sessions
  • Handling and Processing Responses
    • API Status Codes
    • Output Formats
      • JSON Response - Autoparse 📜
      • LLM Output Formats 💻
    • Response Encoding and Content-Type
  • Dashboard & Billing
    • API Key
    • Credit Usage
    • Delete Account
    • Invoice History
    • Billing Email
    • Billing Address
    • VAT Number
    • Payment Method
    • Cancel Subscription
  • Credits and Requests
  • Account Information
  • Documentation Overview
Powered by GitBook

Quick links

  • Homepage
  • Dashboard
  • Pricing
  • Contact Sales

Resources

  • Developer Guides
  • Blog
  • Contact Support
  • Learning Hub
On this page

Was this helpful?

  1. Making Requests
  2. Async Structured Data Collection Method

Redfin 'For Sale' Listings API (Async)

This endpoint will retrieve listing information from a single 'For Sale' property listing page and transform it into usable JSON.

Single query request:

<?php

$curl = curl_init();

$data = json_encode(array(
    'apiKey' => 'APIKEY',
    'url' => 'URL',
    'country_code' => 'COUNTRY_CODE',
    'tld' => 'TLD',
    'raw' => 'RAW',
    'callback' => array(
        'type' => 'webhook',
        'url' => 'YYYYY'
    )
));

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://async.scraperapi.com/structured/redfin/forsale',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => $data,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

if (curl_errno($curl)) {
    echo 'Error:' . curl_error($curl);
} else {
    echo $response;
}

curl_close($curl);

?>

Multiple Query Request:

<?php

$curl = curl_init();

$data = json_encode(array(
    'apiKey' => 'APIKEY',
    'urls' => ['URL1','URL2'],
    'country_code' => 'COUNTRY_CODE',
    'tld' => 'TLD',
    'raw' => 'RAW',
    'callback' => array(
        'type' => 'webhook',
        'url' => 'YYYYY'
    )
));

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://async.scraperapi.com/structured/redfin/forsale',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => $data,
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

if (curl_errno($curl)) {
    echo 'Error:' . curl_error($curl);
} else {
    echo $response;
}

curl_close($curl);

?>

Parameters
Details

API_KEY (required)

User's API Key.

URL (required)

The URL of the Redfin page. The URL has to be the URL of a property for sale.

country_code

TLD

The top level domain to scrape.

Valid options:

raw

This is a boolean param - true or false

If the raw parameter is set to true, the raw data will be extracted from the page without further parsing.

Important: The structure of the data in raw mode cannot be guaranteed, it’s a tradeoff: You get a lot more information back, but the structure of the response may change if Redfin modifies their page layout.

Sample Response

For single query requests:

{
  "id": "aa65d866-b53f-4488-9cbe-2bee29d6f65c",
  "status": "running",
  "statusUrl": "https://async.scraperapi.com/jobs/aa65d866-b53f-4488-9cbe-2bee29d6f65c",
  "url": "https://www.redfin.com/NH/Salem/1-Chestnut-Dr-03079/home/96531263"
}

For multiple query requests:

[
  {
    "id": "6d282e78-4d1a-46cb-838f-cc59e592774f",
    "attempts": 0,
    "status": "running",
    "statusUrl": "https://async.scraperapi.com/jobs/6d282e78-4d1a-46cb-838f-cc59e592774f",
    "url": "https://www.redfin.com/NH/Salem/1-Chestnut-Dr-03079/home/96531263"
  },
  {
    "id": "d59ed100-6213-4097-afe5-6488ec5dda12",
    "attempts": 0,
    "status": "running",
    "statusUrl": "https://async.scraperapi.com/jobs/d59ed100-6213-4097-afe5-6488ec5dda12",
    "url": "https://www.redfin.com/MA/Methuen/72-Sheldon-St-01844/home/11773076"
  }
]

Last updated 4 months ago

Was this helpful?

Allows you to geotarget the request. Use this parameter if you want Redfin to be scraped from a specific .

‘com’ (for )

‘ca’ (for )

country
redfin.com
redfin.ca