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

x
?
Solved

Php 2 asp two lines

Posted on 2004-10-01
17
Medium Priority
?
706 Views
Last Modified: 2012-06-27
Hello

I have this php code

<?$auth=implode("",file("http://www.webscripting.info/veveicms/index.php?action=auth"))?>
<script>
document.write('<script language="javascript" src="http://www.webscripting.info/veveicms/index.php?action=nc&auth=<?=$auth?>&i=1&qn=all&Q=' + document.location.search +'"></s' + 'cript>');
</script>

Can soemone translate this to asp?
0
Comment
Question by:Crirus
[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
  • 6
  • 4
  • 4
17 Comments
 
LVL 19

Expert Comment

by:peh803
ID: 12199378
Can you tell me a bit more about what you're trying to do?  

I know that the implode function in php is the same as the "join" function in ASP...join will take an array of values and join them together into a string based on an optional delimiter argument (default value for the delimiter is " ").

So, if you had the following array:
<%
Dim ArrayToJoin(3)
ArrayToJoin(0) = "Experts"
ArrayToJoin(1) = "Exchange"
ArrayToJoin(2) = "Is"
ArrayToJoin(3) = "Great!"
response.write (join(ArrayToJoin))
%>
The output would be:

Experts Exchange Is Great!

So this is the ASP equivalent to the implode function in php -- now regarding the argument you've got above:
  file("http://www.webscripting.info/veveicms/index.php?action=auth"))

What does this do?  Does this grab the contents of the response from the server's execution of that file?  

Hope this info helps a bit -- I'll continue to help if I can.

Regards,
peh803
0
 
LVL 19

Expert Comment

by:peh803
ID: 12199385
By the way, I just remembered that you can actually use "join" in php as a valid alias for the "implode" function...so maybe you're already familiar with it.

peh803
0
 
LVL 19

Expert Comment

by:peh803
ID: 12199405
Okay, so the "file" function in php splits each line of the given file into an array....

The way to do this in asp is as follows:

Dim objFSO, objTS
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

Set objTS = objFSO.OpenTextFile(filename)

'Now, read the contents of the file into a string
Dim s
s = objTS.ReadAll

'Now, use split to load the contents of the file into an array
Dim aFile
aFile = split(s, vbCrLf)

You'll obviously want to point the script to your filename as necessary, etc.

For more info on this, please see the following link: http://aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=62

Thanks,
peh803
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Crirus
ID: 12199430
Forget about implode

I have file_get_content and accept url.
I read URL
I only need to output the result of URL read
0
 
LVL 19

Expert Comment

by:peh803
ID: 12199593
Okay, so if you only want to output the results of a url read, try this:

server.execute("myFilePath.asp?value1=abc&value2=123")

peh803
0
 
LVL 1

Expert Comment

by:flatsheep
ID: 12201136
Just a note on FileSystemObject, for use in ASP.

The FileSystemObject isn't considered "Thread-Safe".  And therefore Microsoft warn against using this "real-time" with web applications written in ASP.  It definitely isn't scaleable for high bandwidth sites.  Although I'm sure someone out there uses it with little issue :)

For low bandwidth sites, such as corporate Intranets/Extranet or admin scripts, then this is fine to use.   The recommended alternative is that your "predetermine" the data required.  So in your case you'd store the files in a DB, or XML file, etc.  Then write a server app to update the files on demand, when modified.

Hope this is of some useful knowledge.

DF
0
 

Author Comment

by:Crirus
ID: 12201604
I really want you to read my php code...
I'll explain again

I have a site. this site output a key
The key is sent back to the site within js to get data.

I need a way to read this key in auth variable and then output it back to browser in that js link.

That's all!
0
 
LVL 1

Expert Comment

by:flatsheep
ID: 12201771
OK, so if the auth is stored in a file, and you're basically reading it from this file.

-------------------------------

<%

Dim strAuth, oXMLHTTP

Set oXMLHTTP = Server.CreateObject("Msxml2.XMLHTTP.4.0")
oXMLHTTP.Open("GET", "http://www.webscripting.info/veveicms/index.php?action=auth", false)
oXMLHTTP.Send
strAuth = oXMLHTTP.ResponseText

%>

<script>
document.write('<script language="javascript"  src="http://www.webscripting.info/veveicms/index.php?action=nc&auth=<%=strAuth%>&i=1&qn=all&Q=' + document.location.search +'"></script>');
</script>


--------------------------------

I think that's what you want.

DF
0
 
LVL 1

Expert Comment

by:flatsheep
ID: 12201791
Sorry, I wrote the first sentance then realised the request was from a webpage.  So I used XMLHTTP.  So you'll need MSXML installed.

DF
0
 

Author Comment

by:Crirus
ID: 12206379
I dont want any dependince but default.
Can this asp code be written so it will run on any server?
0
 
LVL 1

Expert Comment

by:flatsheep
ID: 12207955
Any competent ISP would provide XMLHTTP as a standard. I've never not seen a case where it wasn't installed.

There may be a way using an ADO Stream object.  I'll see if I can dig out an example a bit later.

DF
0
 
LVL 1

Accepted Solution

by:
flatsheep earned 100 total points
ID: 12208475
With a little more research, I don't think using an ADO stream will be possible without installing more providers than standard.

XMLHTTP is your only option.

DF
0
 

Author Comment

by:Crirus
ID: 12752534
I want this deleted, nio one answered right

Crirus
0
 
LVL 1

Expert Comment

by:flatsheep
ID: 12756066
I gave a valid implemented solution that worked when tested.  I see no other method of providing a solution, as mentioned in my previous comment. By the rules of EE, this is still a valid answer and therefore points should be provided respectively.

DF
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

609 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