Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

$_GET call between URL

Posted on 2017-04-04
3
Medium Priority
?
110 Views
Last Modified: 2017-04-04
<?php
if( $_GET["shortcode"]) {
$api = file_get_contents("https://api.instagram.com/oembed/?url=http://instagram.com/p/"$_GET["shortcode"]"/");      
$apiObj = json_decode($api,true);      
$media_id = $apiObj['media_id'];
echo $_GET["shortcode"];
}

Open in new window


it not work . how can i call $_GET between URL
http://instagram.com/p/"$_GET["shortcode"]"/");

Open in new window

0
Comment
Question by:Mehran Goudarzi
[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
3 Comments
 
LVL 12

Expert Comment

by:Leonidas Dosas
ID: 42077653
Try with isset function:

if(isset( $_GET["shortcode"])){
//code here...
}

Open in new window

0
 
LVL 4

Accepted Solution

by:
Peos John earned 2000 total points
ID: 42077660
You need to add dot(.) to concat the string, Please check the below line.

$api = file_get_contents("https://api.instagram.com/oembed/?url=http://instagram.com/p/".$_GET["shortcode"]."/");      

Open in new window

1
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 42077898
If you're new to PHP and want some good learning resources, this article can help.
https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
The viewer will learn how to count occurrences of each item in an array.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

719 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