Pulling data from a page

Asked

Viewed 114 times

0

I am trying to pull the name and date of birth of my clients from my web page, but it is only pulling the balance and not the name (PHP).

PART PHP

curl_setopt($ch, CURLOPT_URL, 'https://conta.ebanx.com/api/v1/timeline');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            'Host: conta.ebanx.com',
            'Content-Type: application/json; charset=UTF-8',
            'Connection: keep-alive',
            'Authorization: Bearer '.$token.''
            ));

    $d5 = curl_exec($ch);
    $saldo = getstr($d5, 'balance":', ',');
    $nome = getstr($d5, 'full_name":', ',');
    if (strpos($d5, '{"name":"')) {
        print ("<font><font style='color: lime;'>INFO ✓ $nome » $saldo </font>");
    } else {

HTML PART


<!DOCTYPE html><html lang="en"><head><script>dataLayer = [{
  'short_name': "Talita",
  'full_name': "Talita Aranda",
  'locale': "pt-BR",
  'balance': "1.43",
  'balance_formatted': "US$ 1,43",
  'status_account': "Active",
  'has_edc': "No"
}];

"Ah, but why pull that data from authenticated clients?" A: This is for help in saving the balance of the same, always contacting them about any queries

  • Hello, Isabela. Welcome to Stackoverflow. To help, please provide more information about the code and the problem. For example: what the CURL is returning?

  • 1

    It has as you post all the content of $d5?

  • I edited the topic drastically!

  • I don’t know about Curl, but I think you’re making this request wrong. It’s not right to return the header, only json from body.

  • I’m waiting for other answers

  • The function getstr() does not seem to be php native. Not knowing what the implementation is like is difficult to identify the problem.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.