Jump to content

cwiddowson

New Members
  • Posts

    8
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

cwiddowson's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Got the 401 fixed now I'm getting a (405) The requested URL returned error: 405 Method Not Allowed
  2. Thanks for the response, the problem I seem to be having now is: 401 The requested URL returned error: 401 Unauthorized
  3. I changed the json to json_raw since it was already json, but however now I'm getting a CURL (401) The requested URL returned error: 401 Unauthorized
  4. 413 The requested URL returned error: 413 Request Entity Too Large object(stdClass)#1 (6) { ["userId"]=> string( "###" ["groupId"]=> string(6) "###" ["orgId"]=> string(4) "###" ["contactName"]=> string(13) "###" ["userName"]=> string(6) "###" ["attribute"]=> string(5) "Array"
  5. Below is PHP using CURL with JSON to POST data to the MemberClicks API. I keep getting a 413 error when trying to process the page. I've tried a few things, but none seem to work. So far I don't get and syntax errors just on the 413. <?php if (!empty($_POST['userid']) && !empty($_POST['username']) && $_POST['data']=="Update") { $dateATOM = date(DATE_ATOM); $groupid = "12345"; $org = "ABCco"; $userid = $_POST['userid']; $username = $_POST['username']; $contactname = $_POST['contactname']; $email = $_POST['email']; $firstname = $_POST['firstname']; $middlename = $_POST['middlename']; $lastname = $_POST['lastname']; $businessaddress1 = $_POST['businessaddress1']; $businessaddress2 = $_POST['businessaddress2']; $businesscity = $_POST['businesscity']; $businessstate = $_POST['businessstate']; $businessinternationalstate = $_POST['businessinternationalstate']; $businesscountry = $_POST['businesscountry']; $businesszip = $_POST['businesszip']; $companyname = $_POST['companyname']; $title = $_POST['title']; $businessphone = $_POST['businessphone']; $mobilephone = $_POST['mobilephone']; $extension = $_POST['extension']; $fax = $_POST['fax']; $url = $_POST['url']; // Establish $url = 'https://####.memberclicks.net/services/auth'; $data = 'apiKey=123&username=user&password=pass'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $httpHeaders[] = "Accept: application/json"; curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeaders); curl_close($ch); $token = $jsonResult->token; // end --> $raw_json ='{"userId": "'.$userid.'","groupId":"'.$groupid.'","orgId":"'.$org.'","contactName": "'.$contactname.'","userName": "'.$username.'","attribute":[{"userId": "'.$userid.'","attId":"528954","attTypeId":"10", "attData": "'.$username.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"528955","attTypeId":"16", "attData": "'.$contactname.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"528950","attTypeId":"1", "attData": "'.$email.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529209","attTypeId":"2", "attData": "'.$firstname.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529210","attTypeId":"7", "attData": "'.$middlename.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529211","attTypeId":"3", "attData": "'.$lastname.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529213","attTypeId":"28", "attData": "'.$businessaddress1.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529214","attTypeId":"29", "attData": "'.$businessaddress2.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529215","attTypeId":"30", "attData": "'.$businesscity.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529216","attTypeId":"31", "attData": "'.$businessstate.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529240","attTypeId":"7", "attDate": "'.$businessinternationalstate.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529217","attTypeId":"33", "attData": "'.$businesscountry.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529218","attTypeId":"32", "attData": "'.$businesszip.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529219","attTypeId":"7", "attData": "'.$companyname.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529220","attTypeId":"7", "attData": "'.$title.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529221","attTypeId":"5", "attData": "'.$businessphone.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529244", "attData": "'.$mobilephone.'","attTypeId":"5","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529222","attName":"Extension", "attData": "'.$extension.'","lastModify": "'.$dateATOM.'"},{"userId": "'.$userid.'","attId":"529223","attTypeId":"14", "attData": "'.$fax.'","lastModify": "'.$dateATOM.'"}, {"userId": "'.$userid.'","attId":"529228","attTypeId":"15", "attData": "'.$url.'","lastModify": "'.$dateATOM.'"}]}'; $json = json_decode($raw_json); $url2 = 'https://####.memberclicks.net/services/user/'.$userid.'/?includeAtts=true'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url2); curl_setopt($ch, CURLOPT_VERBOSE, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_POST, true); $httpHeaders[] = "Accept: application/json"; $httpHeaders[] = "Authorization: ".$token; curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $httpHeaders ); curl_setopt($ch, CURLOPT_FAILONERROR, true); $results = curl_exec($ch); if (curl_errno($ch)) { echo "<h2>Yes</h2>"; print "<strong>".curl_getinfo( $ch, CURLINFO_HTTP_CODE )."</strong><br><br>"; print "<strong>".curl_error($ch)."</strong><br><br>"; echo "<hr><p>".var_dump($json)."</p>"; } else { echo "<h2>No</h2>"; print curl_getinfo( $ch, CURLINFO_HTTP_CODE ); curl_close($ch); echo "<hr><p>".var_dump($json)."</p>"; //print curl_error($ch); //echo "<p>".$raw_json."</p>"; //header("location: getAll.php?error=Something Happened!"); } return $results; } else { header("location: getAll.php?error=Nothing Happened!"); } ?>
  6. Im only having problems with the "PropName" case which the variable goes to the sql query it just doesnt post??
  7. I tried that but didnt work. below is the code. i have the query spitting on the screen and i will copy and paste it into the sql manager and it pulls, but when its on the web site the php mysql will no execute????? <h1>Sold Properties</h1> <div class="utility-box"> <form name="Search" action="solidproperties.php" method="post"> <input type="hidden" name="ActiveSearch" value="1" /> <table width="100%"> <tr> <td><strong>Sort by:</strong></td> <td class="border-right">Order by:</td> <td><strong>Search:</strong></td> <td></td> <td width="60%"></td> </tr> <tr> <td> <select name="searchtype"> <option value=""></option> <option value="PropName" <? if($_POST["searchtype"]=="PropName"){?>selected<? } ?>>Property Name</option> <option value="City" <? if($_POST["searchtype"]=="City"){?>selected<? } ?>>City</option> <option value="State" <? if($_POST["searchtype"]=="State"){?>selected<? } ?>>State</option> <option value="Broker" <? if($_POST["searchtype"]=="Broker"){?>selected<? } ?>>Broker</option> <option value="BrokerOffice" <? if($_POST["searchtype"]=="BrokerOffice"){?>selected<? } ?>>Broker Office</option> </select> </td> <td class="border-right"> <select name="sortby2"> <option value=""></option> <option value="Units" <? if($_POST["sortby2"]=="Units"){?>selected<? } ?>>Units</option> <option value="Price" <? if($_POST["sortby2"]=="Price"){?>selected<? } ?>>Price</option> <option value="Recent" <? if($_POST["sortby2"]=="Recent"){?>selected<? } ?>>Date</option> </select> <br/> <select name="sortby3"> <option value=""></option> <option value="Units" <? if($_POST["sortby3"]=="Units"){?>selected<? } ?>>Units</option> <option value="Price" <? if($_POST["sortby3"]=="Price"){?>selected<? } ?>>Price</option> <option value="Recent" <? if($_POST["sortby3"]=="Recent"){?>selected<? } ?>>Date</option> </select> </td> <td><input type="text" name="propertysearch" value="<?=$_POST["propertysearch"]?>" id="search" /></td> <td><input type="submit" value="Search" name="submit" /></td> <td class="right"> </td> </tr> </table> </form> </div> <?php if($_POST["ActiveSearch"] == 1){ switch($_POST["searchtype"]){ case "PropName": $SearchCriteria = "AND PropertyName LIKE '%".trim($_POST["propertysearch"])."%'"; break; case "City": $SearchCriteria = "AND PropertyCity LIKE '%".$_POST["propertysearch"]."%'"; break; case "State": $SearchCriteria = "AND PropertyState LIKE '%".$_POST["propertysearch"]."%'"; break; case "Broker": $SearchCriteria = "AND BrokerName LIKE '%".$_POST["propertysearch"]."%'"; break; case "BrokerOffice": $SearchCriteria = "AND BrokerOffice LIKE '%".$_POST["propertysearch"]."%'"; break; default: $SearchCriteria = "AND PropertyName LIKE '%".$_POST["propertysearch"]."%'"; break; } switch($_POST["sortby2"]){ case "Units": $SortCriteria = "ORDER BY NumberOfUnits"; break; case "Price": $SortCriteria = "ORDER BY Price"; break; case "Recent": $SortCriteria = "ORDER BY PropertyID DESC"; break; default: $SortCriteria = "ORDER BY PropertyID DESC"; break; } switch($_POST["sortby3"]){ case "Units": $SortCriteria = $SortCriteria.",NumberOfUnits"; break; case "Price": $SortCriteria = $SortCriteria.",Price"; break; case "Recent": $SortCriteria = $SortCriteria.",PropertyID DESC"; break; } } $SQLQuery = "SELECT * FROM tblproperties WHERE PropertyID != 0 ".$SearchCriteria." ".$SortCriteria.""; echo $SQLQuery; $result = mysql_query($SQLQuery) or die(mysql_error()); if($row = mysql_fetch_array( $result )) { } else{ echo "No properties were found, please try another search."; }
  8. below isnt pulling nothing from the database even though that listing is there??? SELECT * FROM tblproperties WHERE PropertyID <> 0 AND PropertyName LIKE '%Huntington Terraces%' ORDER BY PropertyID DESC
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.