If you have ever used regular proxies for data scraping, integrating the Proxy Endpoint delivery method will be a breeze. All you need to do is use our entry node as a proxy, authorize with Scraper API credentials, and ignore certificates. In cURL, it's -k or --insecure. Your data will reach you on an open connection.
Proxy Endpoint only works with the URL-based data sources, where full URL is provided. Therefore, it only accepts a handful of additional job parameters, which should be sent as headers.
The product is not designed to be used with headless browsers (e.g., Chromium, PhantomJS, Splash, etc.) and their drivers (e.g., Playwright, Selenium, Puppeteer, etc.) directly.
import requestsfrom pprint import pprint# Use your SERP API credentials here.USERNAME, PASSWORD ='YOUR_USERNAME','YOUR_PASSWORD'# Define proxy dict.proxies ={'http':f'http://{USERNAME}:{PASSWORD}@realtime.oxylabs.io:60000','https':f'https://{USERNAME}:{PASSWORD}@realtime.oxylabs.io:60000'}# To set a specific geo-location, user-agent or to render Javascript# it is required to send parameters as request headers.headers ={'x-oxylabs-user-agent-type':'desktop_chrome','x-oxylabs-geo-location':'Germany',#'X-Oxylabs-Render': 'html', # Uncomment if you want to render JavaScript within the page.}response = requests.request('GET','https://www.example.com', headers = headers, # Pass the defined headers. verify=False, # Accept our certificate. proxies=proxies,)# Print result page to stdout.pprint(response.text)# Save returned HTML to 'result.html' file.withopen('result.html', 'w')as f: f.write(response.text)
<?php$ch =curl_init();curl_setopt($ch, CURLOPT_URL,'https://www.example.com/');curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);curl_setopt($ch, CURLOPT_PROXY,'https://realtime.oxylabs.io:60000');curl_setopt($ch, CURLOPT_PROXYUSERPWD,'YOUR_USERNAME'.':'.'YOUR_PASSWORD');curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);// To set a specific geo-location, user-agent or to render Javascript// it is required to send parameters as request headers.curl_setopt_array($ch, array( CURLOPT_HTTPHEADER => array('x-oxylabs-user-agent-type: desktop_chrome','x-oxylabs-geo-location: Germany',//'X-Oxylabs-Render: html', // Uncomment if you want to render JavaScript within the page. )));$result =curl_exec($ch);echo $result;if (curl_errno($ch)) {echo'Error:'.curl_error($ch);}curl_close ($ch);?>
Below you will find a sample response from https://example.com:
Sample response
<!doctypehtml><html><head> <title>Example Domain</title> <metacharset="utf-8" /> <metahttp-equiv="Content-type"content="text/html; charset=utf-8" /> <metaname="viewport"content="width=device-width, initial-scale=1" /> <styletype="text/css">body {background-color:#f0f0f2;margin:0;padding:0;font-family:-apple-system, system-ui, BlinkMacSystemFont,"Segoe UI","Open Sans","Helvetica Neue", Helvetica, Arial, sans-serif; }div {width:600px;margin:5em auto;padding:2em;background-color:#fdfdff;border-radius:0.5em;box-shadow:2px 3px 7px 2pxrgba(0,0,0,0.02); }a:link,a:visited {color:#38488f;text-decoration:none; }@media (max-width:700px) {div {margin:0 auto;width:auto; } } </style> </head><body><div> <h1>Example Domain</h1> <p>This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.</p> <p><ahref="https://www.iana.org/domains/example">More information...</a></p></div></body></html>
Accepted parameters
When making your request, along with the URL, you can send us some job parameters that we will use while executing your job. The job parameters should be sent in your request headers - see an example here.
Here is the list of job parameters that you can send with Proxy Endpoint requests:
Parameter
Description
x-oxylabs-user-agent-type
There is no way to indicate a specific User-Agent, but you can let us know which user-agent type you would like us to use. A list of supported User-Agent types can be found here.
x-oxylabs-geo-location
In some cases, you may need to indicate the geographical location that the result should be adapted for. This parameter corresponds to the geo_location parameter, described separately in source-level documentation. Accepted values depend on the URL you would like us to scrape. Read more here.