Forum Moderators: coopster

Message Too Old, No Replies

ASP to PHP

I don't want to use ASP...

         

web_young

7:49 pm on Nov 8, 2004 (gmt 0)

10+ Year Member



I hope I can explain this. I have an ASP script that goes to a page and grabs some hidden form fields. I was wondering if the same thing can be done using PHP? Here's a snippet from the ASP script.

objXmlHttp.open "GET", "https://sampleurl", False

objXmlHttp.send

' Print out the request status as a comment for debugging purposes:
Response.Write "<!-- Status: " & objXmlHttp.status & " " & objXmlHttp.statusText & " -->"

strHTML = objXmlHttp.responseText

If objXmlHttp.status = 200 Then
TmpStr=mid(strHTML,Instr(strHTML, "sample1"),100)
TmpStr=left(TmpStr,Instr(TmpStr, ">")-2)
TmpStr=mid(TmpStr,Instr(TmpStr,"VALUE")+7)
sample1=TmpStr
TmpStr=mid(strHTML,Instr(strHTML, "sample2"),100)
TmpStr=left(TmpStr,Instr(TmpStr, ">")-2)
TmpStr=mid(TmpStr,Instr(TmpStr,"VALUE")+7)
sample2=TmpStr
TmpStr=mid(strHTML,Instr(strHTML, "sample3"),100)
TmpStr=left(TmpStr,Instr(TmpStr, ">")-2)
TmpStr=mid(TmpStr,Instr(TmpStr,"VALUE")+7)
sample3=TmpStr
End If

coopster

12:19 pm on Nov 9, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



One option would be to grab the page with file_get_contents [php.net] and store it in a string. Then you could use regular expressions (preg_match_all [php.net]) to locate and store the values you are after.