Last active
January 27, 2018 23:01
-
-
Save kellymears/5498483 to your computer and use it in GitHub Desktop.
Business logic to determine if constituent rep had cosponsored a bill
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// RESULTS | |
if(in_array($legislator_id, $cosponsor_ids)) { | |
// echo "Your representative, $legislator_first $legislator_last, is a cosponsor of the legislation."; | |
/* $ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, "http://endgenocide.org/actions/protect-the-rohingya/"); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
$legislator = curl_exec($ch)); | |
curl_close($ch); */ | |
} if($legislator_id==$sponsor_id) { | |
// echo "Your representative, $legislator_first $legislator_last, authored this legislation."; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, "http://endgenocide.org/actions/protect-the-rohingya"); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
$petition = curl_exec($ch); | |
curl_close($ch); | |
print_r($petition); | |
} else { | |
// echo "Your representative, $legislator_first $legislator_last, is not a cosponsor of this legislation."; | |
$non_sponsor_handle = curl_init(); | |
curl_setopt($non_sponsor_handle, CURLOPT_URL, "http://endgenocide.org/actions/protect-the-rohingya/"); | |
curl_setopt($non_sponsor_handle, CURLOPT_RETURNTRANSFER, true); | |
$petition = curl_exec($non_sponsor_handle); | |
$html = str_get_html($petition); | |
$elem = $html->find('div[id=petition-body]', 0); | |
echo $elem; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment