Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Simple Web Service transfer  RSS feed

 
Gaultier Trevor
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm really new to Web Services, and I have a little question for you champions !

So, I have an URL to get informations in JSON, this URL is something like : http://10.200.200.10/webservice/date/28-02-2017/
When I make a cURL in PHP on this URL, I get the JSON formatted message, so that works.

But for now, I have another constraint :

I should have a script between the first PHP script and the final URL. So, I'll have to call something like http://20.500.500.20/get-ws/, which has to get http://10.200.200.10/webservice/date/28-02-2017/.

How could I get, on my first PHP script, the result of the final API if there is another script between ?

I tried to do a cURL with the first PHP that calls the second script which makes itself another cURL, but it doesn't work !
How should I do ?

Thanks for your answers
 
Tim Moores
Saloon Keeper
Posts: 3824
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"It doesn't work" is not a particularly useful problem description. What, exactly, is happening? Does curl work in general on that other server, outside of a PHP script?
 
Gaultier Trevor
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Moores wrote:"It doesn't work" is not a particularly useful problem description. What, exactly, is happening? Does curl work in general on that other server, outside of a PHP script?


Hi thank you for your answer.

In facts, when I try to make a var_dump() on the return of the first PHP cURL (the one that call another cURL), it's NULL.
Yes I tested the cURL and it works on that server !

Maybe my question should be different :

How is it possible to make an HTTP request that gets a response, and transfert this response on another server for example ?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!