January 16th, 2018, 03:51 PM
-
Calling Php script with return function
Good evening
I was wondering if someone can help me in a question: can I call a php script - via post or get - and:
1) either retrieve from the response pure html AND (at the same time) php variables which I can use next - right after the call
2) or execute a function within the response - if it's in the php form?...
The remote script gives back html code with several information.
What I need is to reuse that info within the php or run a function contained within.
Is any of these solutions possible?
Kind regards
JKepler
January 16th, 2018, 08:11 PM
-
It is not clear to me what you are really asking. Passing data from an HTML form to a PHP script is fundamentally the purpose of PHP. Are you asking how to process data on the client side?
Last edited by gw1500se; January 16th, 2018 at 08:50 PM.
There are 10 kinds of people in the world. Those that understand binary and those that don't.
January 17th, 2018, 12:26 AM
-
If it's remote you'll need to send out some sort of data structure like an array. That way you can have values stored for keys like 'html', as well as any other data values that you need to send with it.
As for the sending part, JSON is about the quickest, easiest and most widely used these days, so look into that as well.
January 17th, 2018, 01:41 AM
-
Originally Posted by Catacaustic
If it's remote you'll need to send out some sort of data structure like an array. That way you can have values stored for keys like 'html', as well as any other data values that you need to send with it.
As for the sending part, JSON is about the quickest, easiest and most widely used these days, so look into that as well.
Good morning,
Yes, you are right. Sometimes we think only "2D"... Formating the data wirh a JSON array, with a component HTML and the others with data is the best choice.
Thanks for the thought 
Kind regards
JKepler
January 17th, 2018, 02:32 AM
-
Hi Catacaustic,
I manage to get the answer in html and with the vars - this is good. Tha bad thing, is that the returned html is suposed to echo an image (from a php script called within) which does not shows up...
Any ideas?
Kind regards
JKepler
January 17th, 2018, 06:41 AM
-
You need to start posting some code so we can see what you are doing. Be sure to read the sticky at the top of this forum that says READ THIS BEFORE POSTING first.
There are 10 kinds of people in the world. Those that understand binary and those that don't.
January 17th, 2018, 07:42 AM
-
Greetings,
I'm sorry - you are absolutely right. My apologies. Still, the problem was a base64 encoding routine that was missing - so problem solved.
In the future, I'll try to post the code I have for example and quicker debug (when it's possible of course: in this particular case, the php code has about 12 classes with 100-200 - average - lines of code...)
Thanks.
Kind regards
JKepler
January 17th, 2018, 08:05 AM
-
You only need to post the segment of code that is giving you trouble. If there is not enough info there for someone to understand the code they will ask for more.
There are 10 kinds of people in the world. Those that understand binary and those that don't.