Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4381398
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:38:38+00:00 2026-05-21T12:38:38+00:00

I’ve tried this to get an html element from a public facebook event page

  • 0

I’ve tried this to get an html element from a public facebook event page in a file i named proxy.php:

<?php
  header('Content-Type: text/html');
  $ch = curl_init('http://www.facebook.com/pages/Revive/137584936302228?sk=events');
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  echo curl_exec($ch);
?>

And using this ajax to get the content from it:

$.ajax({
  url: '/wp-content/themes/revive/proxy.php',
  type: 'GET',
  dataType: 'html',
  success: function(data, textStatus, xhr) {
    events = $('div#pagelet_events', data).html();
    // events = $('#text-5', data).html();
    $('#events-section').append(events);
  },
});

But that isn’t working out for some reason. How I can I get this to work?

Thanks!


Update: So that got me closer but looking at the code that the proxy.php it’s not just a div#pagelet_events that’s loading on the page. Not sure if that makes sense. The only thing I can find referencing pagelet_events is this:

<script>big_pipe.onPageletArrive({"phase":3,"id":"pagelet_events","is_last":true,"css":["AJXaB","3cT\/s"],"resource_map":{"AJXaB":{"type":"css","src":"http:\/\/f.static.ak.fbcdn.net\/rsrc.php\/v1\/yO\/r\/qjFDIQwXiny.css"}},"content":{"pagelet_events":"\u003cdiv class=\"UIImageBlock clearfix fbxNullState\">\u003cimg class=\"UIImageBlock_Image UIImageBlock_SMALL_Image img\" src=\"http:\/\/c.static.ak.fbcdn.net\/rsrc.php\/v1\/y9\/r\/56JC9tUWl0q.png\" alt=\"\" width=\"32\" height=\"32\" \/>\u003cdiv class=\"UIImageBlock_Content UIImageBlock_SMALL_Content\">\u003cp>You have no upcoming events.\u003c\/p>\u003c\/div>\u003c\/div>"},"tti_phase":3});</script>   

Any idea if I can pull the content that this script is generating?

Thanks again!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T12:38:39+00:00Added an answer on May 21, 2026 at 12:38 pm

    I think Facebook blocks any request if it comes from (or looks like its coming from) a script/bot. You need to add in a user-agent string to make it seem like it’s a real request.

    I modified your proxy script to this and it works (returns a result).

    <?php
      header('Content-Type: text/html');
      $ch = curl_init('http://www.facebook.com/pages/Revive/137584936302228?sk=events');
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1');
      echo curl_exec($ch);
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.