Jump to content

Travist6983

Members
  • Posts

    39
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Travist6983's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks for the reply yeah i have a working weather one as well that is where my starting code came from <?php $soapclient = new SoapClient('http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL'); $params = array('ZIP' => '48067'); $response = $soapclient->GetCityForecastByZIP($params); echo '<pre>'; var_dump($response); echo '</pre>'; ?> I think there were some issues in my array as well so i have now updated to be this. <?php // Create the client object $soapclient = new SoapClient('Link-To-WSDL-End-Point'); $Header = array( 'UsernameToken' => array( 'Username' => 'Username', 'Password' => 'Password' ) ); $Body = array( 'getItemDetailInfoRequest' => array( 'requestHeader' => array( 'clientRequestId' => 1, 'projectNumber' => 64111, 'requestDateTime' => '2014-03-20T14:05:24.572Z' ), 'getItemDetailInfoList' => array( 'itemDetailSearchCriteria' => array( 'itemNumber' => 'F00573019120B', 'projectNumber' => 64111 ) ) ) ); $response = $client->__soapCall("UsernameToken",array($Header), "getItemDetailInfoRequest",array($Body)); // $response = $soapclient->UsernameToken($Header)->getItemDetailInfoRequest($Body); echo '<pre>'; var_dump($response); echo '</pre>'; ?>
  2. I will warn you that i have never used PHP to call a web service but have spent the last 2 days googling with trial and error and think that i have come to a point where i have no idea what to do as nothing is working. Here is my PHP code... <?php $soapclient = new SoapClient('Link-To-EndPoint'); $params = array('Username' => 'Username', 'Password' => 'Password', 'clientRequestId' => 1, 'projectNumber' => 64111, 'requestDateTime' => '2014-03-16T11:05:24.572Z', 'itemNumber' => 'F00573019120B', 'projectNumber' => 64111 ); $response = $soapclient->GetItemDetailInfo($params); echo '<pre>'; var_dump($response); echo '</pre>'; ?> And here is the request, probably worth noting that this gives the full response and works when i use SOAP UI to make the request. <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Header> <Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <UsernameToken> <Username>Username</Username> <Password>Password</Password> </UsernameToken> </Security> </env:Header> <env:Body> <getItemDetailInfoRequest> <requestHeader> <clientRequestId>1</clientRequestId> <projectNumber>64111</projectNumber> <requestDateTime>2014-03-20T14:05:24.572Z</requestDateTime> </requestHeader> <getItemDetailInfoList> <itemDetailSearchCriteria> <itemNumber>F00573019120B</itemNumber> <projectNumber>64111</projectNumber> </itemDetailSearchCriteria> </getItemDetailInfoList> </getItemDetailInfoRequest> </env:Body> </env:Envelope> When i load the page i get a blank screen nothing comes out from $response, I have no idea if i am close to making this work or if i am super far off with this. Using the above code i am able to make a public weather SOAP Web Service work which makes me think i am close. Any help would be appreciated!
  3. I tried everything except joining the [0] to ['components']['primary_number']; Thank you very much!
  4. OK i am very new to PHP so please be gentle LOL. I am posting a form to Liveaddress API and then i get the response back in an array it looks like this Array ( [0] => Array ( [input_index] => 0 [candidate_index] => 0 [delivery_line_1] => 13700 Oakland St [last_line] => Highland Park MI 48203-3173 [delivery_point_barcode] => 482033173009 [components] => Array ( [primary_number] => 13700 [street_name] => Oakland [street_suffix] => St [city_name] => Highland Park [state_abbreviation] => MI [zipcode] => 48203 [plus4_code] => 3173 [delivery_point] => 00 [delivery_point_check_digit] => 9 ) [metadata] => Array ( [record_type] => S [zip_type] => Standard [county_fips] => 26163 [county_name] => Wayne [carrier_route] => C021 [congressional_district] => 14 [rdi] => Commercial [elot_sequence] => 0024 [elot_sort] => A [latitude] => 42.40858 [longitude] => -83.08783 [precision] => Zip9 ) [analysis] => Array ( [dpv_match_code] => Y [dpv_footnotes] => AABB [dpv_cmra] => N [dpv_vacant] => N [active] => Y [footnotes] => L# ) ) ) How would i take primary_number and turn that into a variable to then insert into a database? Thanks, T
  5. I gotcha that does make more logical sense to me as well. That was actually code that was suggested to me from another forum. But really all they were doing were telling me i am crappy coder which in this case i know i am not great. But they weren't offer to help just kinda bashing me. I appreciate you taking the time to go though it and explain it. Cheers have a great weekend @Barand
  6. Thanks You! @Barand that is now making it work as i expected it too... Your probably right about the alias. Like i mentioned i am VERY new this PHP stuff. Can you kind of explain the difference between what i wrote and how you fixed it?
  7. Thanks for the reply @davidannis It is now throwing my error message that the promocode has already been used but it hasnt been. I am using a blank record from the database. Any other suggestions?
  8. Hello All I have the code below that i cant seem to get to work. At the bottom here you will find my code with a If Else statement. That i just cant get to do what i want. so i am hoping someone can help guide me in the right direction. I am gonna be honest i am VERY new to PHP so please bare with me. On the first If it checks to make sure that the promocode that was entered is in the database and that part works. On the second if i want it to look through the database and find the promocode and confirm that there is not an email address associated with that promocode record. Currently it is not doing that i can enter a promo code that has an email or not and it inserts into the DB. This is where my problem lies am i doing this completely wrong is there a better way to accomplish what i am trying to do here? Or have i just overlooked something small? $promosql = "SELECT email IS NULL or email = '' has_email FROM formdata WHERE promoCode = '$varPromo'"; $promoraw = $mysqli->query($promosql); if($promoraw->num_rows != 1) { $promo .= "$varPromo is not a valid promocode \n"; } else { $row = $promoraw->fetch_assoc(); if ($row['has_email']) { // Promo code has been used $dupe .= "$varPromo has already been used on $varDate \n"; } else { // Insert into table $sql = "INSERT INTO formdata (promoCode, name, email, address, city, state, zip, submitDate) VALUES (". PrepSQL($varPromo) . ", " . PrepSQL($varName) . ", " . PrepSQL($varEmail) . ", " . PrepSQL($varAddress) . ", " . PrepSQL($varCity) . ", " . PrepSQL($varState) . ", " . PrepSQL($varZip) . ", " . PrepSQL($varDate) . ")"; $mysqli->query($sql); header("location: index.php?success=1"); exit(); } }
  9. Thanks for the reply parkerj and thanks for the prevention against SQL injections JD. But it still isnt posting to the database. I am thinking maybe it is the way that i configured the database. I have uploaded a screenshot of PHPMyAdmin below does anything look off to you?
  10. Hello - I am trying to learn PHP here and i have created a simple form that should be posting to the database but i cant for the life of me figure out why? If anyone could point me at what i am missing that would be great PHP Code at the top of my page... <?php if($_POST['formSubmit'] == "Submit") { $mysqli = new mysqli("localhost", "root", "060983tt", "test"); if ($mysqli->connect_error) {die('Connect Error: ' . $mysqli->connect_error);} $varAssign = $_POST['formAssign']; $varDue = $_POST['formDue']; $varLink = $_POST['formLink']; $sql = "INSERT INTO table (assign, due, link) VALUES (". $varAssign . ", " . $varDue . ", " . $varLink . ")"; $mysqli->query($sql); header("location: index.php?success=1"); exit(); } ?> HTML Form <form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post"> <fieldset> <h2>Assignment 1</h2> <div class="form-group"> <label for="exampleInputEmail">Assignment Title</label> <input type="text" class="form-control" name="formAssign1" placeholder="John Smith"> </div> <div class="form-group"> <label for="exampleInputEmail">Due Date</label> <input type="text" class="form-control" name="formDue1" placeholder="john@sample.com"> </div> <div class="form-group"> <label for="exampleInputEmail">File Name </label> <input type="text" class="form-control" name="formLink1" placeholder="123 Main"> </div> <input type="submit" name="formSubmit" value="Submit" class="btn btn-default" /> <?php $success = $_GET["success"]; if(isset($success)) { echo("<div class=\"success\">"); echo "Message was sent successfully!"; echo("</div>\n"); } ?> </fieldset> </form> Thanks
  11. I am pulling my hair out here i want to send the page that the contact form was sent from. I have looked at a 1000 articles about how to do this (Not very good in PHP) But it isnt working for me. Here is the code for my form page <header> <img src="images/header.png"/> </header> <div id="page-wrap"> <div id="contact-area"> <form method="post" action="contactengine.php"> <label for="Name">Name:</label> <input type="text" name="Name" id="Name" /> <label for="City">Market:</label> <input type="text" name="Market" id="Market" /> <label for="Email">Email:</label> <input type="text" name="Email" id="Email" /> <input type="hidden" value="<?php echo $_SERVER['HTTP_REFERER'] ?>" name="Page" /> <input type="submit" name="submit" value="Submit" class="submit-button" /> </form> <div style="clear: both;"></div> </div> </div> And here is the file that i am posting too... <?php $EmailFrom = "sample@gmail.com"; $EmailTo = "sample@gmail.com"; $Subject = "Contact Form"; $Name = Trim(stripslashes($_POST['Name'])); $Market = Trim(stripslashes($_POST['Market'])); $Email = Trim(stripslashes($_POST['Email'])); $Page = $_POST['Page']; // validation $validationOK=true; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Market: "; $Body .= $Market; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Page: "; $Body .= $Page; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to landing page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=success.htm\">"; //Edit here for Landing Page } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?> Everything is being populated on the email that is being sent except $Page which is the hidden field on the form. Am i missing a ";" somewhere that is breaking it? I am lost any help would be appreciated! Thanks in advance!
  12. BAHAHA Thanks Christian For pushing me to find the answer my self! I got it to work! Have a great holiday! Travis
  13. Thanks for replying Christian - is this the line you are talking about? [color=#000000][size=2]echo [/size][/color][color=#008800][size=2]"<td>"[/size][/color][size=2][color="#666600"].[/color][/size]html_entity_decode($row[6])).[color=#008800][size=2]"</td>"[/size][/color][color=#666600][size=2];[/size][/color][color=#000000][size=2] [/size][/color] Thanks! I tried it with out the utf8 stuff $html_decoded = html_entity_decode($row[6]); But that didnt work either... I am not a PHP guy i know just enough to be dangerous... Do i even need to decode it and save it in a variable? or can i do something like this.... html_entity_decode($row[6])
  14. Hello - I am trying to view a table in database that were entered as from a wysiwyg editor. When i export the data it isnt really readable. So i found this little script and was trying to output the data so i could copy it to excel. i am able to get the data out but then it looks like this... <p class="body"> <span style="font-size: 14px;"><span style="color: rgb(0, 0, 255);">Features:</span></span></p> <p> <span style="font-weight: bold;">• Over-sized 0.58" ID for high flow<br /> • Heavy duty 0.25" wall thickness for durability<br /> • Self-weighted for easy installation<br /> So i am trying to output that data without all of the HTML tags using the html_entity_decode, can anyone see where i am going wrong with the below code? <?php // set database server access variables: $host = "localhost"; $user = "*****"; $pass = "********"; $db = "************"; // open connection $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // create query $query = "SELECT * FROM product_description"; // execute query $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); $html_decoded = utf8_encode(html_entity_decode($row[6])); // see if any rows were returned if (mysql_num_rows($result) > 0) { // yes // print them one after another echo "<table cellpadding=10 border=1>"; while($row = mysql_fetch_row($result)) { echo "<tr>"; echo "<td>".$row[2]."</td>"; echo "<td>".$html_decoded."</td>"; echo "<td>".$row[6]."</td>"; // This outputs the row to look something like this [color=#000000][font=Times][size=1]<p class="body"> <span style="font-size: 14px;"><span style="color: rgb(0, 0, 255);">Features:[/size][/font][/color] echo "</tr>"; } echo "</table>"; } else { // no // print status message echo "No rows found!"; } // free result set memory mysql_free_result($result); // close connection mysql_close($connection); ?>
  15. My HERO! Andy thanks so much... when i look at the code you wrote i see where i messing up.... I didnt understand how to store the values from the loop in a new variable... Why is the necessary? $selected_values = ''; everything works just trying to learn something here... Thanks again, Travis
×
×
  • 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.