-1
Hello, I’m trying to get the prices of a page on the iFood site using PHP so that if my client changes the prices he put on their page, the site will already make the automatic correction. The problem is that nothing I try works. I am using the file_get_contents()
and still does not load. Ex:
$contents = file_get_contents('https://www.ifood.com.br/delivery/belo-horizonte-mg/puro-sabor-salgados---carlos-prates-carlos-prates');
print_r($contents);
Does anyone know any way that I can capture this page? I just need to pull its content to a variable that the rest I do the treatment...
The
file_get_contents
should work. Returns nothing, some error or warning?– Sam
Your code is returning the whole page HTML.
– NoobSaibot
Not returning the page
– LeandroLuk
It’s best to do the reverse, update your customer and your site inject the information into iFood. By coincidence I’m with 3 customers currently leaving iFood for a system of their own precisely because iFood ignored a proposal that I had API (answered with a canned email, I decided to discard them and make a system of my own, after all I don’t even think their product is so good) - And to improve, with their own system customers profit more in sales, without having to pay iFood. Jai delete this comment here.
– Bacco
Another thing, for this type of application usually use the lib
curl
is more efficient because all get management, post, cookies etc is kind of ready to use. Generally PHP comes withcurl
installed.– Bacco