Looktrne Posted July 2, 2008 Share Posted July 2, 2008 the following url when run in a browser sends me an email through the contact form of my site.. http://www.abmatch.com/index.php?page=contact_admin&name=webscribble%20webdate%20bugs%2 0fixed&email=mymail@gmail.com&message=Have%20you%20fixed%20the%20bugs%20with%20your%20webscribble%20webdate%20site%20yet?%20visit%20my%20webscribble%20webdate%20support%20forum%20for%20more%20information.%20or%20contact%20me%20directly.%20%3Cbr%3EPaul&action=submit_mail how can I run this url in a php script to get it to work I tried $code = file_get_contents($url); and a little bit or curl but I cant get it to submit... when I paste it in firefox it submits when I click go any help is appreciated Paul Quote Link to comment Share on other sites More sharing options...
p2grace Posted July 2, 2008 Share Posted July 2, 2008 You could treat it as a simple api, create a hidden form and use javascript to submit the form. Quote Link to comment Share on other sites More sharing options...
Looktrne Posted July 3, 2008 Author Share Posted July 3, 2008 I tried what you mentioned and It does not seem to work... could someone tell me why this form would not submit? I am running the file/form on http://peapull.com and it should submit the form to http://abmatch.com here is the code.. <form name="contact_admin" action="http://abmatch.com/index.php?page=contact_admin" method="POST"> <input type="hidden" name="name" value="Webscribble Webdate Bugs Fixed." /> <input type="hidden" name="email" value="myemail@gmail.com" /> <input type="hidden" name="message" value="This is the message body" /> <input type="hidden" name="action" value="submit_mail"> </form> <SCRIPT language="JavaScript"> function submitform() { document.contact_admin.submit(); } </SCRIPT> is there a reason this won't submit? thanks for any help Paul Quote Link to comment Share on other sites More sharing options...
Looktrne Posted July 3, 2008 Author Share Posted July 3, 2008 if anyone knows how to run a url just like a browser through php I can do it that way too.. any help is appreciated Quote Link to comment Share on other sites More sharing options...
p2grace Posted July 3, 2008 Share Posted July 3, 2008 Try this: <form name="contact_admin" id="contact_admin" action="http://abmatch.com/index.php?page=contact_admin" method="post"> <input type="hidden" name="name" value="Webscribble Webdate Bugs Fixed." /> <input type="hidden" name="email" value="myemail@gmail.com" /> <input type="hidden" name="message" value="This is the message body" /> <input type="hidden" name="action" value="submit_mail"> </form> <script type="text/javascript" language="JavaScript"> document.contact_admin.submit(); </script> Quote Link to comment Share on other sites More sharing options...
TransmogriBenno Posted July 3, 2008 Share Posted July 3, 2008 You're using a POST form, when the original URL is a GET request. file_get_contents should work just fine. Quote Link to comment Share on other sites More sharing options...
lemmin Posted July 3, 2008 Share Posted July 3, 2008 The site might be using cookies to see if the user is a bot or something. I would try sniffing the packets and see what stuff is actually getting sent. It might even be checking headers, too. Quote Link to comment Share on other sites More sharing options...
Looktrne Posted July 4, 2008 Author Share Posted July 4, 2008 You're using a POST form, when the original URL is a GET request. file_get_contents should work just fine. your right it does... I dunno I must have done something wrong when I first tested it,, thanks Quote Link to comment Share on other sites More sharing options...
Looktrne Posted July 4, 2008 Author Share Posted July 4, 2008 Ok this worked once and now stopped working again... what would cause this to work intermittently? here is the code: <? $url="http://www.abmatch.com/index.php?page=contact_admin&name=Webscribble Webdate Bugs Fixed&email=myemail@gmail.com&message=Testing 123&action=submit_mail"; echo "Sending=>".$url; $code = file_get_contents($url); echo $code ?> I ran it last night and it worked it sent me the email.... today it echos the contact page... but does not display the email sent succesfully message and I get no email.. it worked last night any ideas why this would work once and not the next day? if I copy paste the url into a browser it submits the form no problem is there a better more relliable way of doing this? thanks Paul Quote Link to comment Share on other sites More sharing options...
Looktrne Posted July 4, 2008 Author Share Posted July 4, 2008 ok considering the file_get_contents($url); was working intermittently I decided to try the form that was posted.. it worked fine with this script <form name="contact_admin" id="contact_admin" action="http://abmatch.com/index.php?page=contact_admin" method="post"> <input type="hidden" name="name" value="Webscribble Webdate Bugs Fixed." /> <input type="hidden" name="email" value="myemail@gmail.com" /> <input type="hidden" name="message" value="This is the message body" /> <input type="hidden" name="action" value="submit_mail"> </form> <script type="text/javascript" language="JavaScript"> document.contact_admin.submit(); </script> <? echo "back"; ?> my only problem is it lands at http://abmatch.com I need it to submit the form and remain in the script so I can submit multiple forms within the same script.. how can I submit this form and have it return to the script thanks Paul Quote Link to comment Share on other sites More sharing options...
Looktrne Posted July 4, 2008 Author Share Posted July 4, 2008 anyone can help me? please ??? Quote Link to comment Share on other sites More sharing options...
p2grace Posted July 5, 2008 Share Posted July 5, 2008 Use iframes to load the api instead of redirecting to it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.