Fetch Cross-domain Content Using a PHP Proxy

If you've ever tried to fetch a resource outside of your domain via an Ajax call, you probably got this error message:

XMLHttpRequest cannot load http://www.domain.com/path/filename.
Origin null is not allowed by Access-Control-Allow-Origin.

This error was triggered by the Same-origin policy. It permits scripts running on pages originating from the same site to access each other's data with no specific restrictions, but prevents scripts from accessing data that is served from a different domain. Luckily, there are ways round it, including:

  • CORS (Cross-Origin Resource Sharing)
  • JSONP (JSON Padding)
  • The postMessage() method
  • Local proxy

This PHP Proxy source code will help you to set up a local proxy, as per item 4 above, to combine document fragments from another domain with your own web content.

You can integrate this PHP Proxy source code into your web application, so you can fetch the contents from 3rd web site and display them on your website.

You can also use this PHP Proxy to solve Mixed Contents Problem when you call a HTTP iframe from a HTTPS secure web page, this PHP Proxy will help you to solve Mixed Contents problem for legacy HTTP systems.

Features:

  • PHP source code, you can deploy it to your server easily.
  • Support Base64 encoding, people can hotlink to your proxy.
  • Unique to the IP address that generated it. A person that generated that URL, can bookmark it and visit it and any point.
  • Unique to that session and IP address, URL no longer valid anywhere when that browser session that generated it ends.
  • Support most popular websites.
  • Show the web page contents between different web sites, cross domains seamlessly.
  • Re-proxy all hyperlinks, images, css, JavaScript in the web pages automatically.
  • Online Web PHP Proxy can also hide you from the Internet. You don't need to install any plugin or software. You can surf the Internet with anonymity.

After you buy this PHP Proxy source code, you can upload it to your server, you can use it by following way,

[iframe id="MyFrame" style="width:850px; height:470px; overflow:hidden; margin-top:15px;" frameborder="0" scrolling="no"
src="http://www.your-web-site.com/phpproxy/index.php?url=https://www.google.com"]
[/iframe]

You can use an iframe to display the contents which fetched from 3rd website, the contents will be shown to your customers from your web server without Cross Domain and Mixed Contents warnings.

How it Works?

The idea is simple; you make a request to your own script to fetch a resource from another domain, and it returns it to your browser. Hence, the content comes from your own server - no more Access-Control-Allow-Origin error! Here's a diagram to illustrate:

Using a local proxy is best for serving up HTML content from another domain when your web host supports some sort of server-side scripting. Just be careful because it also happens to be the riskiest of the cross-domain workarounds due to its importing of raw HTML - and possibly scripting - from other domains.

Write a review

Note: HTML is not translated!
    Bad           Good
Captcha

PHP Proxy Layer Source Code

  • Product Code: MOD181218221521
  • Availability: In Stock
  • Viewed: 2918
  • Units Sold: 8
  • Sold By: Digital Online
  • Seller Rating:
  • Seller Reviews: (0)
  • $19.95

  • Ex Tax: $19.95

Available Options


Related Products

PHP Script for PDF, DOCX, HTML Invoice Maker/Creator

PHP Script for PDF, DOCX, HTML Invoice Maker/Creator

PHP Script to Make an Invoice - Save to PDF, DOCX, HTML formats PDF/DOCX/HTML Invoice Generation ..

$39.00 Ex Tax: $39.00

jQuery Multiple File Uploader

jQuery Multiple File Uploader

jQuery Multiple File Uploader is a new and modern multiple file uploader, offering a wide variety of..

$9.95 Ex Tax: $9.95

Responsive Ajax Contact Form

Responsive Ajax Contact Form

PHP Contact Form - Modern & Responsive Contact Form PHP Contact Form uses JavaScript to send fill..

$9.95 Ex Tax: $9.95

PHP Invoice Generator

PHP Invoice Generator

PHP Invoice Generator - PHP Class For Beautiful PDF Invoices, it supports HTML Templates also. ..

$59.00 Ex Tax: $59.00

PDF Viewer for WordPress & JavaScript

PDF Viewer for WordPress & JavaScript

PDF Viewer Plugin for WordPress & JavaScript PDF Viewer Plugin for WordPress & JavaScript is a resp..

$39.00 Ex Tax: $39.00

Website Screenshot API for PHP

Website Screenshot API for PHP

Website Screenshot API (PHP Web Page Screenshot API) does capture screenshot of any webpage with o..

$59.95 Ex Tax: $59.95

Excel to HTML Table Converter With Search & Pagination using PHP, Excel To PDF

Excel to HTML Table Converter With Search & Pagination using PHP, Excel To PDF

Excel to HTML Table Converter is a great PHP script that will help you to importing Excel data int..

$29.95 Ex Tax: $29.95

Save
25%

PHP Email Extractor

PHP Email Extractor

PHP Email Extractor - the Best tool for extracting any email address. Extract email addresses from..

$14.95 $19.95 Ex Tax: $14.95

Save
17%

Photo Slideshow and Thumbnail Viewer JavaScript Source Code

Photo Slideshow and Thumbnail Viewer JavaScript Source Code

Photo Slideshow JS is a Photo Slideshow and Thumbnail Viewer JavaScript Source Code, it is an image,..

$24.95 $29.95 Ex Tax: $24.95

Save
10%

PHP Script - Web Page Password Protect

PHP Script - Web Page Password Protect

PHP Script :: Web Page Password Protect Password protect your content with Web Page Password Protec..

$8.95 $9.95 Ex Tax: $8.95

PHP Web Email Crawler

PHP Web Email Crawler

PHP Web Email Crawler Email Spider / Email Crawler is most powerful web based tool to extract e..

$49.99 Ex Tax: $49.99

Save
12%

PHP Web Page Password Protect

PHP Web Page Password Protect

Protect web page with a simple password, Password protect PHP Script. The best and easiest way to l..

$7.95 $9.00 Ex Tax: $7.95

PHP Ajax Mailer With Multiple Attachments

PHP Ajax Mailer With Multiple Attachments

PHP Ajax Mailer With Multiple Attachments Hey there, hope you are doing well, if you are looking ..

$10.00 Ex Tax: $10.00

Web Crawler and Scraper for Emails, Links, Phone Numbers and Image URLs, PHP Source Code

Web Crawler and Scraper for Emails, Links, Phone Numbers and Image URLs, PHP Source Code

Web Crawler and Scraper for Emails, Links, Phone Numbers and Image URLs. Web Crawler and Scraper ..

$29.95 Ex Tax: $29.95

Tags: online proxy, php proxy, web proxy