PHP - Button To Send A Tweet And Checking The Tweet Was Posted
Hi
I am trying to get a user to click a button and for that to then post a twitter message but I also want to do a check to make sure the tweet was posted. How can I go about this? Thankyou in advance Similar TutorialsThis topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=351451.0 Hi, How does one post a tweet on their account through a PHP script? What I want to happen is simply post a tweet on my account when a user adds a new picture or comment to my site. I have seen many examples online but none seem to work. Surely it is very simple? Example of working script would be very much appreciated. I am bit confused. Can we display the latest tweet in the webpage. Hello guys, I've been reading through various threads here about getting latest tweets with php but they're all basically methods I've seen before, and involve getting the tweets from the atom feed xml. I've been experimenting with various code snippets that do this on my site, and most of the time they work. But about one in every 10 times it doesn't, because for some reason the tweet doesn't appear in the atom feed. I guess this is a problem with Twitter, but I've google this, and to be honest there's only a few whispers from people that could be experiencing something like this problem, which makes me wonder whether I'm just unlucky or being stupid and overlooking something..? I don't see what though. Anyway I know there's methods where you can actually log into your twitter acount and post tweets, and all the rest of it, but the codes I've found are all extremely lengthy and arcane, and do far more than what I want them to. So what I'm wondering is- has anyone used this foolproof method of retrieving tweets, and if so I wonder is you could share your code with me, or point me in the right direction? All I want to do is get my latest tweet and display it on my site. Many Thanks I am getting these errors . This is my complete HTML page. Everything seems to work fine but when i retweet a message these error show up. Here is my tweet.php and the errors are at line 32 and 41. Previously there was an error at line 24: It was like this: '.((!empty($tweet->retweetMsg) && $tweet->tweetID === $retweet['tweetID'] or $tweet->retweetID > 0) ? ' I changed it to this and the error went away '.((isset($retweet['retweetID']) ? $retweet['retweetID'] === $tweet->retweetID OR $tweet->retweetID > 0 : '') ? ' Maybe this could help! I will really appreciate any suggestion coming my way! Following is the form.Now i want to see if submit button is pressed or not.Usually if html had Code: [Select] <input type="submit" value="Submit" name = "submit" /> i would simply use Code: [Select] <?php if(isset($_POST['submit'])) ?> But below is the form which has an image as a submit button Form - Code: [Select] <form action="" method="post" id="sendemail"> <ol> <li> <label for="name">Name (required)</label> <input id="name" name="name" class="text" /> </li> <li> <label for="email">Email Address (required)</label> <input id="email" name="email" class="text" /> </li> <li> <label for="email">Phone number</label> <input id="phone" name="phone" class="text" /> </li> <li> <label for="address">Address(required)</label> <input id="address" name="address" class="text" /> </li> <li> <label for="city">City(required)</label> <input id="city" name="city" class="text" /> </li> <li> <label for="state">State(required)</label> <input id="state" name="state" class="text"/> </li> <li> <label for="zipcode">Pincode/Zipcode(required)</label> <input id="zipcode" name="zipcode" class="text" /> </li> <li> <input type="image" name="submit" id="imageField" src="images/submit.gif" class="send" /> <div class="clr"></div> </li> </ol> </form> How should i check if form is submitted or not when instead of submit button there is an image ? ----------------------------------------------------------------- Alternative Solution ---------------------------------------------------------------------------- I tried sending it to other page but then i had to send an array back to this page and i didn't know how to send that either.I tried Code: [Select] <?php $error = serialize($error); echo "<meta http-equiv='refresh' content='0;url=about.php?array=".$error."'> "; ?> But even after Code: [Select] $array = unserialize($array); $array contained nothing. Can someone please show me how to send in array in between pages for future ? I am trying to allow a user to proceed to another page but only after a user has clicked a Facebook like button and a check has been done to check if the currently logged in user has liked the specific Facebook Page. How can I go about this? Thanks in advance I am creating a Registration form and want to have a command button in the middle of the form that, when clicked, will send the user an email with an activation code. How can I do that? When the user clicks the button, I would like it to fire off an email, however I do not want the user to be taken off of the form or to lose anything the entered. I suppose you would normally do this with JavaScript, but since I don't know that, I am looking for a PHP solution for now. Thanks. I am working on a phpmailer script that sends an order confirmation email to the customer AND the client at the same time. If I have the customer email and client email set both to the originating domain's email addresses (myname@myserver.com), then it sends fine. However, if I try to send to an outside mail server (eg. someone@gmail.com), I get the following errors: Code: [Select] SMTP -> FROM SERVER:220 myserver.com ESMTP Exim 4.63 Sat, 18 Sep 2010 15:08:21 -0700 SMTP -> FROM SERVER: 250 myserver.com Hello localhost [127.0.0.1] 250-SIZE 52428800 250-PIPELINING 250-AUTH LOGIN PLAIN 250-STARTTLS 250 HELP SMTP -> FROM SERVER:250 OK SMTP -> FROM SERVER:250 Accepted SMTP -> FROM SERVER: SMTP -> ERROR: RCPT not accepted from server: SMTP Error: The following recipients failed: someone@gmail.com Message could not be sent. Mailer Error: SMTP Error: The following recipients failed: someone@gmail.com SMTP server error: I'm not sure what's going on here. Any SMTP or phpmailer geniuses here that can shed some light on what needs to happen here for this to send to any address? Hi, I'm trying to setup a quick PHP script that will grab the email from the url (see below) and after inserting into MySQL db - which is working fine - the script will complete two additional tasks: 1. send that same captured email out to a external db as in shown via http://domain1.com/insert.php?email=$lead (example), but then send to a DIFFERENT source - the originator of the lead - a portback acknowledgement using Header (sending the status and email to http://domain2.com/check.php?e=$lead&s=$status for their records). See the code below: ------------------------- Code: [Select] $lead = $_REQUEST['e_mail']; // will grab email from posted url string and assign to local variable $result = mysql_query($command); // this is just to execute the MySQL insert which works just fine but included here to explain validation below // Create API Call string to insert lead into iContact folder $requestURL = "http://domain1.com/insert.php?email=$lead"; // Execute API Call to CAKE $xml = simplexml_load_file($requestURL) or die("feed not loading"); if ($result) { $status = 1; // mark lead as sucess // send postback on lead status header("Location: http://domain2.com/check.php?e=$lead&s=$status"); } -------- Problem: I'm getting all sorts of errors with the simplexml_load_file() function and can't figure out why it won't work. Any input appreciated as this the only way I know how to pass the lead onward and then inform/update the other party of receipt of information. thanks! When I submit my form the variables are sent to the url in my address bar and not to the php post page (resersend.php). Here is the pertinent html page code (index.html)... Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript"> function showMonth(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","reserv.php?q="+str,true); xmlhttp.send(); } </script> </head> <body> <form> <p><font face="arial" size="2" color="#336600">Reservation month:</font> <select name="months" onchange="showMonth(this.value)"> <option value="" selected="selected">Choose One</option> <option value="May 2011">May 2011</option> <option value="June 2011">June 2011</option> <option value="July 2011">July 2011</option> <option value="August 2011">August 2011</option> <option value="September 2011">September 2011</option> <option value="October 2011">October 2011</option> <option value="November 2011">November 2011</option> <option value="December 2011">December 2011</option> <option value="January 2012">January 2012</option> <option value="February 2012">February 2012</option> <option value="March 2012">March 2012</option> <option value="April 2012">April 2012</option> </select> </form></p> </body> </html> And here is the php code from the page (reserv.php) that works with the above html page... Code: [Select] <?php $q=$_GET["q"]; $con = mysql_connect('My_host', 'my_user', 'my_password'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("my_db", $con); $sql="SELECT * FROM daterange WHERE DEND > DATE(NOW()) AND STATUS='A' AND MONTH = '".$q."' ORDER BY RID, DATE, SITE"; $result = mysql_query($sql); // Determine the number of reservation dates $number = mysql_numrows($result); // Create drop-down menu of reservation dates print "<font size=\"3\" face=\"Arial\"><b>Select Your Reservation:</b><br> <form action=\"resersend.php\" method=\"post\"> <select name=\"RID\"> <option value=\"\">Choose One</option>"; for ($i=0; $i<$number; $i++) { $RID = mysql_result($result,$i,"RID"); $DATE = mysql_result($result,$i,"DATE"); $SITE = mysql_result($result,$i, "SITE"); $PRICE = mysql_result($result,$i, "PRICE"); print "<option value=\"$RID\">$DATE, $SITE, $PRICE</option>"; } print "</select><p align=left><label><font size=\"3\" face=\"Arial\">First Name: <input type=\"text\" name=\"FNAME\" size=\"50\" maxlength=\"50\" tabindex=\"1\"<br>"; print "<p align=left><label>Last Name: <input type=\"text\" name=\"LNAME\" size=\"50\" maxlength=\"50\" tabindex=\"2\"<br>"; print "<p align=left><label>Address Line 1: <input type=\"text\" name=\"ADDR1\" size=\"50\" maxlength=\"50\" tabindex=\"3\"<br>"; print "<p align=left><label>Address Line 2: <input type=\"text\" name=\"ADDR2\" size=\"50\" maxlength=\"50\" tabindex=\"4\"<br>"; print "<p align=left><label>City: <input type=\"text\" name=\"CITY\" size=\"50\" maxlength=\"50\" tabindex=\"5\"<br>"; print "<p align=left><label>State (abbrev.): <input type=\"text\" name=\"STATE\" size=\"2\" maxlength=\"2\" tabindex=\"6\"<br>"; print "<p align=left><label>Zip Code: <input type=\"text\" name=\"ZIP\" size=\"5\" maxlength=\"5\" tabindex=\"7\"<br>"; print "<p align=left><label>Contact Phone Number: (<input type=\"text\" name=\"PHONE1\" size=\"3\" maxlength=\"3\" tabindex=\"8\""; print "<label>)<input type=\"text\" name=\"PHONE2\" size=\"3\" maxlength=\"3\" tabindex=\"9\""; print "<label>-<input type=\"text\" name=\"PHONE3\" size=\"4\" maxlength=\"4\" tabindex=\"10\"<br>"; print "<p align=left><label>Email: <input type=\"text\" name=\"EMAIL\" size=\"50\" maxlength=\"50\" tabindex=\"11\"<br>"; print "<p align=left><input type=\"submit\" value=\"Book Now!\" name=\"submit\">"; print "<input type=\"reset\" value=\"reset\" name=\"reset\"></form>"; // Close the database connection mysql_close($con); ?> I am sure this is easy, but any help would be greatly appreciated. Thanks. I have a status system, built with ajax, and I need to get the unique id that the database assigns to the post and return it in the results that are appended to the page via javascript, however I'm not sure how the bessst way would be to do this? I have been doing this: ///variables that are sent to the database $session = $_COOKIE['id']; $uid = $_POST['id']; $post = $_POST['post']; $date = mktime(); //way I have got the unique id of this post $query = mysql_fetch_assoc(mysql_query("SELECT * FROM posts WHERE from_id='$session' AND to_id='$uid' AND post='$post' AND date='$date'")); $id = $query['id']; Although that does work, It feels like it might not always be accurate. Hi Friends, I have form in that i am sending some values using POST method. But i cant able to get values using $_POST['var'] or $_REQEUST['var'] Data is not coming in IE6, But it is coming in firefox and other browsers even in IE8. What may be problem? any settings i have to make for IE6. ? Any suggestions I need to echo back the users drop down selection. How can I do this without storing the value? Code: [Select] $isset = $_POST['industry']; foreach ($industries as $industry) { if (isset($isset) && $industry['industry_id'] == $isset) { echo "<option value=\"{$industry['industry_id'] }\" selected=\"selected\">${industry['industry']}</option>\n"; } else { echo "<option value=\"{$industry['industry_id'] }\">${industry['industry']}</option>\n"; } } How can I echo the $id? Every time I post approved it refreshes my page and I can see the echoed out ID. I need to know what the ID value is. Code: [Select] if (isset($_POST['approve'])) { if(is_array($_POST['approve'])) { $keys = array_keys($_POST['approve']); $id = $keys[0]; echo $id; die(); //$sql = "UPDATE `blog_comments` SET `approved` = 1 WHERE `post_id` = '$id'"; //header("Location: " . $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'] ); } } I need some help displaying the posted values onto a second page. I thought I was doing it right, but nothing is showing up on my second page. I have my form set to PHP_SELF to validate before sending the user to the second page, and it's working just fine. If no errors are present, the user is redirected to the second page, but it's supposed to be displaying their posted data, but it's not. What am I doing wrong? Code: [Select] <?php /*$name = ""; $address = ""; $city = ""; $state = ""; $zip = ""; $phone = ""; $position = ""; $display_errors = "";*/ if (@$_POST['submitted']){ $name = (@$_POST['name']); $address = (@$_POST['address']); $city = (@$_POST['city']); $state = (@$_POST['state']); $zip = (@$_POST['zip']); $phone = (@$_POST['phone']); $position = (@$_POST['position']); if (get_magic_quotes_gpc()){ $name = stripslashes($name); $address = stripslashes($address); $city = stripslashes($city); $state = stripslashes($state); $zip = stripslashes($zip); $phone = stripslashes($phone); $position = stripslashes($position); } $error_msg=array(); if ($name==""){ $error_msg[]="Please enter your name"; } if ($address==""){ $error_msg[]="Please enter your address"; } if ($city==""){ $error_msg[]="Please enter your city"; } if ($state==""){ $error_msg[]="Please enter your state"; } if ($zip==""){ $error_msg[]="Please enter your zip code"; } if ($phone==""){ $error_msg[]="Please enter your phone number"; } if ($position==""){ $error_msg[]="Please enter your desired position"; } if ($error_msg){ $display_errors = "<ul style=color:red>\n"; foreach ($error_msg as $err){ $display_errors .= "<li>".$err."</li>\n"; } $display_errors .= "</ul>\n"; } if (!$error_msg){ //echo $name . "<br>"; //echo $address . "<br>"; //echo $city . "<br>"; //echo $state . "<br>"; header('Location: process_U2IP.php'); exit(); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Forms1.php</title> </head> <body> <div id="content"> <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post"> <h3>Please fill out the form below and upload your resume to apply for a position within our company:</h3> <label for="name">Name*</label><br /> <input name="name" type="text" size="20" id="name" value="<?php echo $name; ?>" /><br /> <label for="address">Address*</label><br /> <input name="address" type="text" size="20" id="address" value="<?php echo $address; ?>" /><br /> <label for="city">City*</label><br /> <input name="city" type="text" size="20" id="city" value="<?php echo $city; ?>" /><br /> <label for="state">State*</label><br /> <input name="state" type="text" size="20" id="state" value="<?php echo $state; ?>" /><br /> <label for="zip">Zip*</label><br /> <input name="zip" type="text" size="20" id="zip" value="<?php echo $zip; ?>" /><br /> <label for="phone">Phone*</label><br /> <input name="phone" type="text" size="20" id="phone" value="<?php echo $phone; ?>" /><br /> <label for="position">Position*</label><br /> <input name="position" type="text" size="20" id="position" value="<?php echo $position; ?>" /><br /> <p><i>Your information will not be sold or shared with others.</i></p> <p style="color: red;">* denotes required field</p> <input type="hidden" name="submitted" value="1" /> <input type="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /> </form> <?php echo $display_errors; ?> </div> </body> </html> Code: [Select] <?php $name = (@$_POST['name']); $address = (@$_POST['address']); $city = (@$_POST['city']); $state = (@$_POST['state']); $zip = (@$_POST['zip']); $phone = (@$_POST['phone']); $position = (@$_POST['position']); $display_block = " <table> <tr> <td><b>Name:</b></td> <td>$name</td> </tr> <tr> <td><b>Address:</b></td> <td>$address</td> </tr> <tr> <td><b>City:</b></td> <td>$city</td> </tr> <tr> <td><b>State:</b></td> </tr> </table>"; echo $display_block; ?> It's just displaying the table but with no values or blank values for the posted variables. Can anyone help? am coming across the problem. When I use copied text in my input form it gives some characters this � character.
I am not sure how to post text so this doesn't happen.
Example:
This line copied:
The 976cc, 101-hp Rotax® 1000R V-Twin engine is known for its reliable power.
Produces:
The 976cc, 101-hp Rotax� 1000R V-Twin engine is Can-Am's most powerful side-by-side engine.
My code:
if (get_magic_quotes_gpc()) { $description_clean_magic = stripslashes($description); } else { $description_clean_magic = $description; } Hi everyone,
I've been running a self-written php shopping cart for the last 8 years, with lots of success. Recently however, the credit card processor (Linkpoint) I use upgraded their gateway, and now I have a problem.
Basically, the last page of my checkout does a _POST to a specific url for their gateway. I send through a bunch of <input> variables, some of them hidden, but all of them check out okay. I have combed over their specs, made sure I'm not sending any bad characters, made sure I've got the right format for the fields they want, etc...
Right now the transaction is successful, the customer's card is charged, but Linkpoint's system is returning an error message: We are unable to process your request due to invalid data.
Long story short, their support staff has asked me to "send them the xml string" via email. I have no idea how to do this (even after spending a few hours online trying to figure it out).
Is there a simple way to generate the xml string that's being passed during the _POST? Some kind of php code I can incorporate into my final checkout page, run a test transaction, and maybe write the string out somewhere so I can get it to them?
Any help you guys could give me would be greatly appreciated. Thanks in advance! Danny |