Skip to content

Instantly share code, notes, and snippets.

@PerfectlyNormal
Last active June 10, 2017 12:19
Show Gist options
  • Save PerfectlyNormal/87b3d8e03dbdb555f663a961266776be to your computer and use it in GitHub Desktop.
Save PerfectlyNormal/87b3d8e03dbdb555f663a961266776be to your computer and use it in GitHub Desktop.
<?php
header('Access-Control-Allow-Origin: *');
$src = 'https://www.goodreads.com/review/custom_widget/2268122.Reading?cover_position=middle&cover_size=medium&num_books=5&order=d&shelf=currently-reading&show_author=1&show_cover=1&show_rating=0&show_review=0&show_tags=0&show_title=1&sort=date_added&widget_bg_color=FFFFFF&widget_bg_transparent=&widget_border_width=1&widget_id=1494711042&widget_text_color=000000&widget_title_size=medium&widget_width=thin';
$contents = file_get_contents($src);
$start = strpos($contents, "var widget_code = ' ") + strlen("var widget_code = ' ");
$end = strpos($contents, "var widget_div") - $start - 4;
$html = substr($contents, $start, $end);
$stripped = str_replace('\/', '/', str_replace('\n', '', str_replace('\"', '"', str_replace("\'", "'", $html))));
echo $stripped;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment