Forum Replies Created

Viewing 6 replies - 31 through 36 (of 36 total)
  • Hi Jeremy,

    My turn. I’m getting the “Error code: -32301” when trying to connect to LinkedIn. I’ve tried clearing my cache, using different computers and using different browsers. The url is connected to WordPress.com with JetPack and I used the https://jetpack.me/support/debug/ page you suggested earlier in this thread and it says all is fine. I’ve also tried deactivating all other plugins and still get the same error. The last thing I tried was deleting all the plugin filed for JetPack and re-installing. Still no luck. Do you have any other suggestions?

    url: https://finseldercare.com/

    url with error: https://finseldercare.com/wp-admin/options-general.php?page=sharing&action=error&publicize_error=-32301

    Thread Starter Insight Dezign

    (@insightdezign)

    Thank you gentleman.

    I feel pretty dumb. The email from sunlightlabs gave me API in it so I just copied it and used it. I didn’t bother to read the full email that said I needed to click on the link to activate the API.

    Hopefully others who have the same problem will learn from my mistake.

    I really appreciate you taking the time though. You are very professional.

    Thread Starter Insight Dezign

    (@insightdezign)

    I just tried that and it just moved my error to line 37. I sent you login information so you can try if you like. I can resend it if you like.

    Thread Starter Insight Dezign

    (@insightdezign)

    I have, I’ve looked through the code and can’t seem to find the error either . It’s very frustrating

    Thread Starter Insight Dezign

    (@insightdezign)

    Let me correct that. When I copied the code it formatted it correctly. I then copied it and tried it in the plugin. and got back almost the same error but with line 34.

    Warning: Invalid argument supplied for foreach() in I_removed my_server_directory_structure_for_security/wp-content/plugins/congresslookup/getData.php on line 34

    Thread Starter Insight Dezign

    (@insightdezign)

    Hi Again, Thanks for getting back to me. I am still unable to get it to function. The same thing happens when I download your zipped getData.php file. Every other php file uncompressed properly with the correct formatting. This one looks like this when uncompressed:

    <?php
    
    	if(isset($_GET['lat']) && isset($_GET['lon']))
    	{
    
    		require_once('../../../wp-load.php');
    		$url = plugin_dir_url(__FILE__);
    
    		$api_call = "https://services.sunlightlabs.com/api/legislators.allForLatLong.json?apikey=".get_option('congress_key')."&latitude=".$_GET['lat']."&longitude=".$_GET['lon'];
    
    		if(get_option("congress_cache"))
    		{
    			require 'API_cache.php';
    			$cache_file = 'cache/'.md5($api_call).'.json';
    			$cache_for = get_option("congress_cache_time"); // cache time in minutes
    
    			$api_cache = new API_cache ($api_call, $cache_for, $cache_file);
    			$congress = $api_cache->get_api_cache();
    		}
    		else
    			$congress = @file_get_contents($api_call);
    
    		if($congress )
    		{
    			$congress = json_decode($congress);
    
    			if(get_option("congress_options"))
    				$a = get_option("congress_options");
    			else
    				$a = array();
    
    			echo '<div class="legislators_list">';
    
    			foreach ($congress->response->legislators as $c) {
    				$pic_name = "pics/".$c->legislator->bioguide_id.".jpg";
    
    				if(is_array($a) &&count($a) > 0)
    				{
    					echo "<h3 class='legislator'>".$c->legislator->firstname." ".$c->legislator->lastname." <small>(".$c->legislator->state." ".$c->legislator->district.")</small></h3>";
    
    					if(in_array("picture", $a))
    					{
    						if(file_exists($pic_name)) echo "<img class='legislator-pic' src='".$url.$pic_name."' width='40' height='50' alt='' />";
    						else echo "<img class='legislator-pic' src='".$url."pics/unknown.jpg' width='40' height='50' alt='' />";
    					}
    
    					echo "<ul class='legislator-contact'>";
    
    					foreach($c->legislator AS $key=>$value)
    					{
    						if(in_array($key, $a))
    						{
    							if(empty($value)) $value = "Not Available";
    							if(strpos($value, "http:") !== false) $value = '<a href="'.$value.'" target="_blank" rel="nofollow">'.$value.'</a>';
    							echo "<li>$key:  $value</li>";
    						}
    					}
    
    					echo "</ul>";
    				}
    
    				else
    				{
    					echo "<h3 class='legislator'>".$c->legislator->firstname." ".$c->legislator->lastname." <small>(".$c->legislator->state." ".$c->legislator->district.")</small></h3>";
    				}
    
    			} 
    
    			echo '<div style="clear:both"></div></div>';
    
    		}
    		else echo "Error1";
    	}
    	else echo "Error2";
    ?>

    I’ve tried reformatting it to this:

    <?php
    
    	if(isset($_GET['lat']) && isset($_GET['lon']))
    	{
    
    		require_once('../../../wp-load.php');
    		$url = plugin_dir_url(__FILE__);
    
    		$api_call = "https://services.sunlightlabs.com/api/legislators.allForLatLong.json?apikey=".get_option('congress_key')."&latitude=".$_GET['lat']."&longitude=".$_GET['lon'];
    
    		if(get_option("congress_cache"))
    		{
    			require 'API_cache.php';
    			$cache_file = 'cache/'.md5($api_call).'.json';
    			$cache_for = get_option("congress_cache_time"); // cache time in minutes
    
    			$api_cache = new API_cache ($api_call, $cache_for, $cache_file);
    			$congress = $api_cache->get_api_cache();
    		}
    		else
    			$congress = @file_get_contents($api_call);
    
    		if($congress )
    		{
    			$congress = json_decode($congress);
    
    			if(get_option("congress_options"))
    				$a = get_option("congress_options");
    			else
    				$a = array();
    
    			echo '<div class="legislators_list">';
    
    			foreach ($congress->response->legislators as $c) {
    				$pic_name = "pics/".$c->legislator->bioguide_id.".jpg";
    
    				if(is_array($a) &&count($a) > 0)
    				{
    					echo "<h3 class='legislator'>".$c->legislator->firstname." ".$c->legislator->lastname." <small>(".$c->legislator->state." ".$c->legislator->district.")</small></h3>";
    
    					if(in_array("picture", $a))
    					{
    						if(file_exists($pic_name)) echo "<img class='legislator-pic' src='".$url.$pic_name."' width='40' height='50' alt='' />";
    						else echo "<img class='legislator-pic' src='".$url."pics/unknown.jpg' width='40' height='50' alt='' />";
    					}
    
    					echo "<ul class='legislator-contact'>";
    
    					foreach($c->legislator AS $key=>$value)
    					{
    						if(in_array($key, $a))
    						{
    							if(empty($value)) $value = "Not Available";
    							if(strpos($value, "http:") !== false) $value = '<a href="'.$value.'" target="_blank" rel="nofollow">'.$value.'</a>';
    							echo "<li>$key:  $value</li>";
    						}
    					}
    
    					echo "</ul>";
    				}
    
    				else
    				{
    					echo "<h3 class='legislator'>".$c->legislator->firstname." ".$c->legislator->lastname." <small>(".$c->legislator->state." ".$c->legislator->district.")</small></h3>";
    				}
    
    			} 
    
    			echo '<div style="clear:both"></div></div>';
    
    		}
    		else echo "Error1";
    	}
    	else echo "Error2";
    ?>

    But it still gives me this error:

    Warning: Invalid argument supplied for foreach() in I_removed my_server_directory_structure_for_security/wp-content/plugins/congresslookup/getData.php on line 35

Viewing 6 replies - 31 through 36 (of 36 total)