Overview: I'm trying to add an EventBrite event using the EventBrite API with nothing but the URL as an input.
For example, a user inputs [the url] and I should be able to pull the "eid" from [the url].
I know that the source of http://pitchevent-startups.eventbrite.com/ does this: [script] ... window.eid = "123456"; ... [/script] and I want to retrieve this 开发者_开发技巧"123456" value for my own purposes (adding the event to a list.)
How can I access this? Javascript preferred, but php will be OK too.
Thanks!
You could use PHP to get the eid
, like this:
<?php
$url='http://pitchevent-startups.eventbrite.com/';
if (preg_match('/window\.eid\s*=\s*\"(\d*)\";/',file_get_contents($url),$match)){
echo "eid: ".$match[1];
}
?>
You can't; cross-host requests are disallowed by browsers for security reasons.
精彩评论