Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

PHP - Getting hidden post variable from external page.

Posted on 2004-09-03
2
Medium Priority
?
2,726 Views
Last Modified: 2013-12-13
Okay, this is a complicated question that requires a really specific answer, so I am going to try to be as specific as possible.

I am trying to make a PHP script that allows my friends to Text message my Cricket wireless cell phone from the internet, but bypasses their prompt page that displays an accept/decline deal.  Now, I do not want anyone telling me to make an email script to text message mynumber@carriersext.com because cricket does not have this service, i promise.

Now here is where my problem comes in,  when someone goes to the cricket text messaging webiste:

http://www.mycricket.com/SendtextMessage.aspx

It generates a HUGE random encoded message, that is required to be submited as a variable to the ASP file in order to send the message.  Now, It works great if i just copy and paste one of those encoded things right from the page, but each code expires after 3 messages are sent.  So, is what I need to do is make a PHP script/function to go and access that page each time the script is ran, and grab that huge encoded variable, and set it to a variable in my PHP script.  I am almost positive this is possible, it just might be pretty complicated, that's why I made it worth so many points..


To find that varaible I am talking about... veiw the source of http://www.mycricket.com/SendtextMessage.aspx and search for the string:

<input type="hidden" name="__VIEWSTATE"




You'll see what I mean.  If you need any clearifications, please don't hesitate to ask.
0
Comment
Question by:evanatmtd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
CosminB earned 2000 total points
ID: 11979209
try this:
<?php
$contents = file_get_contents('http://www.mycricket.com/SendtextMessage.aspx', false);
$start = strpos($contents, '<input type="hidden" name="__VIEWSTATE" value="') + strlen('<input type="hidden" name="__VIEWSTATE" value="');
$stop = strpos($contents, '"', $start+1);
$text = substr($contents, $start, $stop-$start);
echo $text;
?>

if you don't have PHP > 4.3.0 use
$contents = implode('',file('http://www.mycricket.com/SendtextMessage.aspx'));
insetad of
$contents = file_get_contents('http://www.mycricket.com/SendtextMessage.aspx', false);
0
 

Author Comment

by:evanatmtd
ID: 11981297
oh my god i love you! lol, thanks a million, that worked PERFECT.  I have been looking for this for months.  GREAT code.  I give you an A+++++.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question