• Index » 
  • Community » 
  • Tech » 
  • Pulling dynamic content from outside sources with PHP?
TheDonkey
Eat my bearrrrrrrrrrr, Tonighttt
+163|5687|Vancouver, BC, Canada
Hey, so I'm just wondering if anyone knows of where I could find tutorials on using PHP scripts to log into other websites (submit the HTMl forms), find a certain text string, and return its value. (Then save it to a variable to be inserted anywhere else)

Basically I'm trying to use my existing web server to log in to my cell phone carrier's online interface, load the page that shows my current data usage this month and extract just the actual text string with the number in KB. Then I'll embed it into my own pages.
Eventually if I figure that out, I'll expand for other services, I'm eventually hoping to pull a number of different services to create a HUD-page of sorts for my Droid. (Or possibly a Homescreen widget if I decide to dedicate the time to learn the language)


I've heard of similar things done before but can't seem to figure out what to search for or how to do it anywhere.
chuyskywalker
Admin
+2,439|6818|"Frisco"

You'll want to be investigating CURL. Probably the most tutorials out there for that. "Page Scraping" is a good term to lookup. You'll also need to know the URL's for form submission in advance and the page you want to get the real data from. Cookies (from the login) will be a factor here. Also, if they employ any basic security, it could make the whole endeavor, while not impossible, far more effort than you'll likely want to put into it.
TheDonkey
Eat my bearrrrrrrrrrr, Tonighttt
+163|5687|Vancouver, BC, Canada
Thanks chuy! That's exactly what I was looking for.

I dunno, their login/form submission system is really weird, but by the looks of it the just sue a single cookie to validate your login, then they just use URL variables to submit requests for the data used.
HaiBai
Your thoughts, insights, and musings on this matter intrigue me
+304|5454|Bolingbrook, Illinois
you can download Fiddler to view the GET/POST requests so you have the necessary information to replicate the connection.

i don't know about PHP, but C# and other languages have cookie storage objects you can use

http://msdn.microsoft.com/en-us/library … ainer.aspx

maybe PHP has something similar you can use
TheDonkey
Eat my bearrrrrrrrrrr, Tonighttt
+163|5687|Vancouver, BC, Canada
A quick google search leads me to believe that cURL stores session cookies by default (as long as you stay within a single instance of the module)
  • Index » 
  • Community » 
  • Tech » 
  • Pulling dynamic content from outside sources with PHP?

Board footer

Privacy Policy - © 2024 Jeff Minard